Commit 3cdc356
committed
refactor(home): sync ChatSurfaceProvider callback refs in a layout effect
Mutating refs during render is unsound under concurrent rendering (render
may run multiple times before commit); useLayoutEffect commits the latest
callbacks before any user event can fire.1 parent ae9d435 commit 3cdc356
1 file changed
Lines changed: 15 additions & 4 deletions
File tree
- apps/sim/app/workspace/[workspaceId]/home/components/chat-surface-context
apps/sim/app/workspace/[workspaceId]/home/components/chat-surface-context/chat-surface-context.tsx
Lines changed: 15 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
4 | 12 | | |
5 | 13 | | |
6 | 14 | | |
| |||
55 | 63 | | |
56 | 64 | | |
57 | 65 | | |
58 | | - | |
59 | 66 | | |
60 | | - | |
61 | 67 | | |
62 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
63 | 74 | | |
64 | 75 | | |
65 | 76 | | |
| |||
0 commit comments