Commit 37c8fee
committed
fix(devtools): guard useLayoutEffect against null ref in ContextMenu
The useLayoutEffect in ContextMenu accesses ref.current without
checking for null. When portalContainer is missing or items is empty,
the component returns null (no portal rendered), leaving ref.current
as null and causing a crash on the subsequent .contains() call.
Guard the effect with the same early-return condition used by the
render path (portalContainer == null || items.length === 0) so the
effect is a no-op when no portal is mounted.1 parent e49335e commit 37c8fee
1 file changed
Lines changed: 7 additions & 1 deletion
File tree
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
78 | 84 | | |
79 | 85 | | |
80 | 86 | | |
| |||
0 commit comments