Commit 54cfa95
authored
DevTools: fix initial host instance selection (#31892)
Related: #31342
This fixes RDT behaviour when some DOM element was pre-selected in
built-in browser's Elements panel, and then Components panel of React
DevTools was opened for the first time. With this change, React DevTools
will correctly display the initial state of the Components Tree with the
corresponding React Element (if possible) pre-selected.
Previously, we would only subscribe listener when `TreeContext` is
mounted, but this only happens when user opens one of React DevTools
panels for the first time. With this change, we keep state inside
`Store`, which is created when Browser DevTools are opened. Later,
`TreeContext` will use it for initial state value.
Planned next changes:
1. Merge `inspectedElementID` and `selectedElementID`, I have no idea
why we need both.
2. Fix issue with `AutoSizer` rendering a blank container.1 parent d5f3c50 commit 54cfa95
3 files changed
+37
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
348 | | - | |
349 | | - | |
350 | 348 | | |
351 | 349 | | |
352 | 350 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
| |||
190 | 191 | | |
191 | 192 | | |
192 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
193 | 197 | | |
194 | 198 | | |
195 | 199 | | |
| |||
265 | 269 | | |
266 | 270 | | |
267 | 271 | | |
| 272 | + | |
268 | 273 | | |
269 | 274 | | |
270 | 275 | | |
| |||
481 | 486 | | |
482 | 487 | | |
483 | 488 | | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
484 | 493 | | |
485 | 494 | | |
486 | 495 | | |
| |||
1431 | 1440 | | |
1432 | 1441 | | |
1433 | 1442 | | |
| 1443 | + | |
1434 | 1444 | | |
1435 | 1445 | | |
1436 | 1446 | | |
| |||
1507 | 1517 | | |
1508 | 1518 | | |
1509 | 1519 | | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
1510 | 1530 | | |
1511 | 1531 | | |
1512 | 1532 | | |
| |||
Lines changed: 17 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
836 | 836 | | |
837 | 837 | | |
838 | 838 | | |
839 | | - | |
840 | 839 | | |
841 | 840 | | |
842 | 841 | | |
| |||
899 | 898 | | |
900 | 899 | | |
901 | 900 | | |
902 | | - | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
903 | 904 | | |
904 | | - | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
905 | 910 | | |
906 | 911 | | |
907 | 912 | | |
| |||
914 | 919 | | |
915 | 920 | | |
916 | 921 | | |
917 | | - | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
918 | 925 | | |
919 | 926 | | |
920 | 927 | | |
| |||
929 | 936 | | |
930 | 937 | | |
931 | 938 | | |
932 | | - | |
| 939 | + | |
933 | 940 | | |
934 | | - | |
935 | | - | |
936 | | - | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
937 | 945 | | |
938 | 946 | | |
939 | 947 | | |
| |||
0 commit comments