Commit ffa66ff
authored
fix: error overlay not closing when backdrop clicked (#83981)
The ref object wasn't passed to the hook; instead, ref.current (the
value) was passed. This caused `useOnClickOutside` to be noop on initial
render when ref.current was null, and only worked later because the
component re-rendered with a different value. The fix ensures the hook
always has access to the current DOM element whenever the effect runs.
### Before
https://github.com/user-attachments/assets/baa7ea6c-9506-4f14-8950-b4e7e7abbe61
### After
https://github.com/user-attachments/assets/18c3c569-ca30-41c3-ae92-f2d3e8fcee4c1 parent 4160af2 commit ffa66ff
File tree
2 files changed
+7
-6
lines changed- packages/next/src/next-devtools/dev-overlay
- components/dialog
- hooks
2 files changed
+7
-6
lines changedLines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
| 40 | + | |
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
| |||
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | | - | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | | - | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
0 commit comments