Commit d7f0b3d
Keep the record selection authoritative during a stale-prop re-render
After handleChange dispatches a new selection to the store, the synchronous
forceRender can re-render before the selectionStart/selectionEnd props have
propagated. The render-time sync then overwrote the just-updated record with
the stale props and re-applied a stale caret to the DOM, dropping characters
at the wrong position while typing in a re-render-heavy context (e.g. an HTML
block's static inner blocks). Track the selection just dispatched and skip
the sync while the props still lag behind it.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent af53431 commit d7f0b3d
1 file changed
Lines changed: 33 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
5 | 10 | | |
6 | 11 | | |
7 | 12 | | |
| |||
97 | 102 | | |
98 | 103 | | |
99 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
100 | 117 | | |
101 | 118 | | |
102 | 119 | | |
103 | 120 | | |
104 | | - | |
105 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
106 | 124 | | |
107 | 125 | | |
108 | 126 | | |
| |||
113 | 131 | | |
114 | 132 | | |
115 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
116 | 145 | | |
117 | 146 | | |
118 | 147 | | |
| |||
152 | 181 | | |
153 | 182 | | |
154 | 183 | | |
| 184 | + | |
155 | 185 | | |
156 | 186 | | |
157 | 187 | | |
| |||
0 commit comments