Commit 9ea702f
authored
fix(react): React Compiler strips memoization and causes MenuPortal to re-mount (#2077)
### 💡 Overview
This change removes the use of a randomly generated portal ID and
instead uses a ref backed DOM element as the FloatingPortal root. Using
Math.random() during render is not recommended and causes issues with
some versions of React Compiler since the compiler may strip or reorder
memoization.1 parent be82657 commit 9ea702f
File tree
4 files changed
+6
-7
lines changed- packages/react-sdk/src/components/Menu
- sample-apps/react/react-dogfood
4 files changed
+6
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
| |||
59 | 58 | | |
60 | 59 | | |
61 | 60 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 61 | + | |
66 | 62 | | |
67 | 63 | | |
68 | 64 | | |
69 | | - | |
| 65 | + | |
70 | 66 | | |
71 | | - | |
| 67 | + | |
72 | 68 | | |
73 | 69 | | |
74 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7607 | 7607 | | |
7608 | 7608 | | |
7609 | 7609 | | |
| 7610 | + | |
7610 | 7611 | | |
7611 | 7612 | | |
7612 | 7613 | | |
| |||
0 commit comments