Commit f07d4da
committed
fix: ensure custom element updates don't run in hydration mode
When a custom element is created before Svelte hydration kicks in, it will scaffold itself, using the properties given via attributes.
Now when a custom element property is set during Svelte's hydration, the Svelte custom element component could run logic like updating an each block. Without turning off hydration mode during that time, the update would try to pick up existing element nodes (because it thinks they must be there because of hydration mode), and crash.
No test because it would require a setup where we can ensure the element is scaffolded before hydration runs.
Fixes #152131 parent f67cf20 commit f07d4da
File tree
1 file changed
+21
-1
lines changed- packages/svelte/src/internal/client/dom/elements
1 file changed
+21
-1
lines changedLines changed: 21 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
216 | 222 | | |
217 | 223 | | |
218 | 224 | | |
| |||
239 | 245 | | |
240 | 246 | | |
241 | 247 | | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
242 | 251 | | |
243 | 252 | | |
244 | 253 | | |
| |||
262 | 271 | | |
263 | 272 | | |
264 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
265 | 281 | | |
266 | 282 | | |
267 | 283 | | |
| |||
415 | 431 | | |
416 | 432 | | |
417 | 433 | | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
418 | 438 | | |
419 | 439 | | |
420 | 440 | | |
| |||
0 commit comments