Skip to content
This repository was archived by the owner on Sep 21, 2021. It is now read-only.

Commit 850b73a

Browse files
committed
Render Reps as TINY mode when the node is expanded.
Doing this makes the tree less cluttered.
1 parent c8fc0d7 commit 850b73a

File tree

5 files changed

+15
-11
lines changed

5 files changed

+15
-11
lines changed

packages/devtools-reps/src/object-inspector/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,9 @@ class ObjectInspector extends Component {
388388
? MODE.SHORT
389389
: MODE.TINY;
390390
}
391+
if (expanded) {
392+
repsProp.mode = MODE.TINY;
393+
}
391394

392395
objectValue = this.renderGrip(item, repsProp);
393396
}

packages/devtools-reps/src/object-inspector/tests/component/__snapshots__/entries.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ exports[`ObjectInspector - entries does not call enumEntries if entries are alre
5151
`;
5252
5353
exports[`ObjectInspector - entries renders Object with entries as expected 1`] = `
54-
"▼ Map { Symbol(a) → \\"value-a\\", Symbol(b) → \\"value-b\\" }
54+
"▼ Map
5555
| size : 2
5656
| ▼ <entries>
5757
| | ▼ 0 : Symbol(a) → \\"value-a\\"
@@ -60,5 +60,5 @@ exports[`ObjectInspector - entries renders Object with entries as expected 1`] =
6060
| | ▼ 1 : Symbol(b) → \\"value-b\\"
6161
| | | <key> : Symbol(b)
6262
| | | <value> : \\"value-b\\"
63-
| ▼ __proto__ : Object {}"
63+
| ▼ __proto__ : {}"
6464
`;

packages/devtools-reps/src/object-inspector/tests/component/__snapshots__/proxy.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`ObjectInspector - Proxy renders Proxy as expected 1`] = `
4-
"▼ Proxy { <target>: {}, <handler>: […] }
4+
"▼ Proxy
55
| ▶︎ <target> : Object {}
66
| ▶︎ <handler> : Array [ … ]
77
| __proto__ : Object { }"

packages/devtools-reps/src/object-inspector/tests/component/__snapshots__/state.js.snap

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ exports[`ObjectInspector - state has the expected expandedPaths state 1`] = `
66
`;
77
88
exports[`ObjectInspector - state has the expected expandedPaths state 2`] = `
9-
"▼ Object { p0: \\"0\\", p1: \\"1\\", p2: \\"2\\", p3: \\"3\\", p4: \\"4\\", p5: \\"5\\", p6: \\"6\\", p7: \\"7\\", p8: \\"8\\", p9: \\"9\\", … }
9+
"▼ {}
1010
| a : 1
1111
| Symbol() : \\"hello\\"
1212
| ▶︎ __proto__ : Object {}
@@ -20,17 +20,17 @@ exports[`ObjectInspector - state has the expected expandedPaths state 3`] = `
2020
2121
exports[`ObjectInspector - state has the expected expandedPaths state 4`] = `
2222
"▶︎ Object { p0: \\"0\\", p1: \\"1\\", p2: \\"2\\", p3: \\"3\\", p4: \\"4\\", p5: \\"5\\", p6: \\"6\\", p7: \\"7\\", p8: \\"8\\", p9: \\"9\\", … }
23-
▼ Proxy { <target>: {}, <handler>: […] }
23+
▼ Proxy
2424
| ▶︎ <target> : Object {}
2525
| ▶︎ <handler> : Array [ … ]"
2626
`;
2727
2828
exports[`ObjectInspector - state has the expected expandedPaths state 5`] = `
29-
"▼ Object { p0: \\"0\\", p1: \\"1\\", p2: \\"2\\", p3: \\"3\\", p4: \\"4\\", p5: \\"5\\", p6: \\"6\\", p7: \\"7\\", p8: \\"8\\", p9: \\"9\\", … }
29+
"▼ {}
3030
| a : 1
3131
| Symbol() : \\"hello\\"
3232
| ▶︎ __proto__ : Object {}
33-
▼ Proxy { <target>: {}, <handler>: […] }
33+
▼ Proxy
3434
| ▶︎ <target> : Object {}
3535
| ▶︎ <handler> : Array [ … ]"
3636
`;
@@ -41,7 +41,7 @@ exports[`ObjectInspector - state has the expected state when expanding a node 1`
4141
`;
4242
4343
exports[`ObjectInspector - state has the expected state when expanding a node 2`] = `
44-
"▼ Object { p0: \\"0\\", p1: \\"1\\", p2: \\"2\\", p3: \\"3\\", p4: \\"4\\", p5: \\"5\\", p6: \\"6\\", p7: \\"7\\", p8: \\"8\\", p9: \\"9\\", … }
44+
"▼ {}
4545
| __proto__ : Object { }
4646
▶︎ Proxy { <target>: {}, <handler>: […] }"
4747
`;
@@ -53,17 +53,17 @@ exports[`ObjectInspector - state has the expected state when expanding a proxy n
5353
5454
exports[`ObjectInspector - state has the expected state when expanding a proxy node 2`] = `
5555
"▶︎ Object { p0: \\"0\\", p1: \\"1\\", p2: \\"2\\", p3: \\"3\\", p4: \\"4\\", p5: \\"5\\", p6: \\"6\\", p7: \\"7\\", p8: \\"8\\", p9: \\"9\\", … }
56-
▼ Proxy { <target>: {}, <handler>: […] }
56+
▼ Proxy
5757
| ▶︎ <target> : Object {}
5858
| ▶︎ <handler> : Array [ … ]
5959
| ▶︎ __proto__ : Object { }"
6060
`;
6161
6262
exports[`ObjectInspector - state has the expected state when expanding a proxy node 3`] = `
6363
"▶︎ Object { p0: \\"0\\", p1: \\"1\\", p2: \\"2\\", p3: \\"3\\", p4: \\"4\\", p5: \\"5\\", p6: \\"6\\", p7: \\"7\\", p8: \\"8\\", p9: \\"9\\", … }
64-
▼ Proxy { <target>: {}, <handler>: […] }
64+
▼ Proxy
6565
| ▶︎ <target> : Object {}
6666
| ▶︎ <handler> : Array [ … ]
67-
| ▼ __proto__ : Object { }
67+
| ▼ __proto__ : {}
6868
| | ▶︎ __proto__ : Object { }"
6969
`;

packages/devtools-reps/src/object-inspector/tests/component/function.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ describe("ObjectInspector - functions", () => {
6363
it("renders non-TINY mode functions as expected", () => {
6464
const stub = functionStubs.get("Named");
6565
const oi = mount(ObjectInspector(generateDefaults({
66+
autoExpandDepth: 0,
6667
roots: [{
6768
path: "root",
6869
name: "x",

0 commit comments

Comments
 (0)