Skip to content

Instantly share code, notes, and snippets.

@jasonLaster
Created July 31, 2019 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonLaster/82ba42a9be355e01f500cb7fd10a6769 to your computer and use it in GitHub Desktop.
Save jasonLaster/82ba42a9be355e01f500cb7fd10a6769 to your computer and use it in GitHub Desktop.
diff --git a/devtools/client/debugger/src/components/Editor/InlinePreview.js b/devtools/client/debugger/src/components/Editor/InlinePreview.js
index 606281bbd30a..3e3cfeab6680 100644
--- a/devtools/client/debugger/src/components/Editor/InlinePreview.js
+++ b/devtools/client/debugger/src/components/Editor/InlinePreview.js
@@ -17,19 +17,20 @@ const {
type Props = {
line: number,
- value: any,
variable: string,
+ preview: Object
};
// Renders single variable preview inside a codemirror line widget
class InlinePreview extends PureComponent<Props> {
- showInScopes(variable) {
+ showInScopes(variable: Object) {
// TODO: focus on variable value in the scopes sidepanel
console.log(`show ${variable}`);
}
render() {
- const { value, variable } = this.props;
+ const { preview, variable } = this.props;
+ const value = preview[variable];
return (
<span onClick={() => this.showInScopes(variable)}>
<span>{variable}</span>
@@ -40,19 +41,19 @@ class InlinePreview extends PureComponent<Props> {
}
}
-const mapStateToProps = (state, ownProps) => {
- const thread = getCurrentThread(state);
- const selectedFrame = getSelectedFrame(state, thread);
+// const mapStateToProps = (state, ownProps) => {
+// const thread = getCurrentThread(state);
+// const selectedFrame = getSelectedFrame(state, thread);
- return {
- value: getInlinePreviewExpression(
- state,
- thread,
- selectedFrame.id,
- ownProps.line,
- ownProps.variable
- ),
- };
-};
+// return {
+// value: getInlinePreviewExpression(
+// state,
+// thread,
+// selectedFrame.id,
+// ownProps.line,
+// ownProps.variable
+// ),
+// };
+// };
-export default connect(mapStateToProps)(InlinePreview);
+export default InlinePreview;
diff --git a/devtools/client/debugger/src/components/Editor/InlinePreviewRow.js b/devtools/client/debugger/src/components/Editor/InlinePreviewRow.js
index 515d72f14d0b..9a5dd3864e37 100644
--- a/devtools/client/debugger/src/components/Editor/InlinePreviewRow.js
+++ b/devtools/client/debugger/src/components/Editor/InlinePreviewRow.js
@@ -73,8 +73,7 @@ class InlinePreviewRow extends PureComponent<Props> {
ReactDOM.render(
<React.Fragment>
{Object.keys(preview).map(variableName => (
- // <span>TEST</span> - This works
- <InlinePreview line={line} variable={variableName} />
+ <InlinePreview line={line} variable={variableName} preview={preview} />
))}
</React.Fragment>,
this.IPWidget.node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment