Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

[Scopes] expanded properties are not updated while stepping #2509

Merged
merged 11 commits into from Apr 5, 2017
14 changes: 13 additions & 1 deletion src/utils/object-inspector.js
Expand Up @@ -181,7 +181,19 @@ function getChildren(
// node would be a new instance every render.
const key = item.path;
if (actors && actors[key]) {
return actors[key];
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 && getValue(cacheObject) != properties[pKey].value) {
thisActor[cacheObjectIndex].contents = properties[pKey];
}
}
}
return thisActor;
Copy link
Contributor

@bomsy bomsy Mar 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! If we move this change to the ObjectInspector.js here instead.
Then we can do this.props.setActors(actors); after, which will set the cached actor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great suggestion! I thought using this.props.setActors(actors); in render would cause an error, but I was wrong! Thank you! 😊

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding actors[key] = thisActor; above this line should update actorCache

Copy link
Contributor

@bomsy bomsy Apr 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also , the actors[key] only goes stale across the ObjectInspector component loads (i.e during stepping), therefore across internal component renders we should still be fine doing return actors[key]if it exists, due to performance reasons.

}

if (isBucket(item)) {
Expand Down