You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 21, 2021. It is now read-only.
Update the roots object to another object, but keep the same path value
Expected results:
The ObjectInspector is updated and shows the new roots children
Actual results:
The ObjectInspector is not updated.
This is due to the fact that we cache nodes, and never clear the cache. The getChildren then uses this cache and find matching nodes since the path stayed the same.
This issue is resolved when the following test pass:
diff --git a/packages/devtools-reps/src/object-inspector/tests/component/basic.js b/packages/devtools-reps/src/object-inspector/tests/component/basic.js
index bf27ca0..80800e8 100644
--- a/packages/devtools-reps/src/object-inspector/tests/component/basic.js+++ b/packages/devtools-reps/src/object-inspector/tests/component/basic.js@@ -261,4 +261,40 @@ describe("ObjectInspector - renders", () => {
}]});
expect(formatObjectInspector(oi)).toMatchSnapshot();
});
++ it("updates when the root changes but has same path", () => {+ let oi = mount(ObjectInspector(generateDefaults({+ roots: [{+ path: "root",+ name: "root",+ contents: [{+ name: "a",+ contents: {+ value: 30,+ }+ }, {+ name: "b",+ contents: {+ value: 32,+ }+ }]+ }],+ mode: MODE.LONG,+ })));+ oi.find(".node").at(0).simulate("click");++ const oldTree = formatObjectInspector(oi);+ oi.setProps({roots: [{+ path: "root",+ name: "root",+ contents: [{+ name: "c",+ contents: {+ value: "i'm the new node",+ }+ }]+ }]});++ expect(formatObjectInspector(oi)).not.toBe(oldTree);+ });
});