This repository was archived by the owner on Sep 21, 2021. It is now read-only.
Commit c4f3be0
committed
Use symbols for nodes path.
Fixes #1001, #1002 & #1003.
The path property on a node is very important as it serve
as an identifier to know if a node is expanded, and what
its properties are. Currently, this path was a simple string
which could led to 2 nodes having the same path, which could
have unwanted effect on user interaction.
To avoid this, the path is now a symbol, which has the advantage
of being unique.
Because of this change, we needed to adapt our code so we always
have the same path reference in the state.
With this patch, we'll always dispatch the nodePropertiesLoaded action,
even if the node don't have any properties. We'll store null in the state,
so we can then check if a node was properly handled.
As a result, we change the shouldComponentUpdate of the component
to reflect this new behavior.
In order to have always the same reference, we always add created node
to the cacheNodes property, which we can do because of the change in
loadedProperties.
This should also give us some performance improvements as we don't have
to recreate some nodes twice.
We take this as an opportunity to change the signature of the createNode
function to be more explicit (it now expect an object of options), and
we also create the path of the node from its parent when the path option
is not supplied.1 parent b6819f6 commit c4f3be0
File tree
3 files changed
+163
-146
lines changed- packages/devtools-reps/src/object-inspector
- utils
3 files changed
+163
-146
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
| |||
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
73 | | - | |
74 | | - | |
75 | | - | |
| 76 | + | |
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
117 | | - | |
118 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
119 | 129 | | |
120 | 130 | | |
121 | 131 | | |
| |||
151 | 161 | | |
152 | 162 | | |
153 | 163 | | |
154 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
155 | 167 | | |
156 | 168 | | |
157 | 169 | | |
| |||
426 | 438 | | |
427 | 439 | | |
428 | 440 | | |
429 | | - | |
| 441 | + | |
430 | 442 | | |
431 | 443 | | |
432 | 444 | | |
| |||
0 commit comments