[Scopes] expanded properties are not updated while stepping #2509
Changes from 3 commits
96fc2a6
47f48cd
1e61143
a6ef1b4
b1ed6d1
79bb50b
ac94d3a
1e41c11
ed50775
7932d8f
8557ef9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -162,6 +162,7 @@ class Expressions extends React.Component { | |
this.editExpression(expression, options), | ||
loadObjectProperties, | ||
getActors: () => ({}), | ||
setActors: () => {}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
}), | ||
CloseButton({ handleClick: e => this.deleteExpression(e, expression) }) | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ type ObjectInspectorItemContents = { | |
}; | ||
|
||
type ObjectInspectorItem = { | ||
contents: Array<ObjectInspectorItem> & ObjectInspectorItemContents, | ||
contents: ObjectInspectorItemContents & Array<ObjectInspectorItem>, | ||
name: string, | ||
path: string, | ||
}; | ||
|
@@ -86,7 +86,7 @@ const ObjectInspector = React.createClass({ | |
getExpanded: PropTypes.func, | ||
setExpanded: PropTypes.func, | ||
getActors: PropTypes.func.isRequired, | ||
setActors: PropTypes.func, | ||
setActors: PropTypes.func.isRequired, | ||
}, | ||
|
||
actors: (null: any), | ||
|
@@ -122,6 +122,26 @@ const ObjectInspector = React.createClass({ | |
getChildren(item: ObjectInspectorItem) { | ||
const { getObjectProperties } = this.props; | ||
const { actors } = this; | ||
const key = item.path; | ||
|
||
if (item.contents.value && item.contents.value.preview && actors[key]) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tiny note, just for security |
||
const properties = item.contents.value.preview.ownProperties; | ||
let thisActor = actors[key]; | ||
for (let pKey in properties) { | ||
if (properties.hasOwnProperty(pKey)) { | ||
const cacheObject = thisActor.filter(a => a.name == pKey)[0]; | ||
const cacheObjectIndex = thisActor.findIndex(a => a.name == pKey); | ||
// Assign new values to the cache actor if it becomes stale | ||
if ( | ||
cacheObject && cacheObject.contents.value != properties[pKey].value | ||
) { | ||
thisActor[cacheObjectIndex].contents = properties[pKey]; | ||
} | ||
} | ||
} | ||
actors[key] = thisActor; | ||
this.props.setActors(actors); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm wondering if we can simplify the cache significantly. The way i see it working is that it would keep a key of IDs that are expanded and that's it. This way, values don't need to be synced... |
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can this move to |
||
|
||
return getChildren({ | ||
getObjectProperties, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will return
undefined
, should besetActors: () => ({})
instead