Commit 28765f8
authored
fix: don't rerun async effects unnecessarily (#16944)
Since #16866, when an async effect runs multiple times, we rebase older batches and rerun those effects. This can have unintended consequences: In a case where an async effect only depends on a single source, and that single source was updated in a later batch, we know that we don't need to / should not rerun the older batch.
This PR makes it so: We collect all the sources of older batches that are not part of the current batch that just committed, and then only mark those async effects as dirty which depend on one of those other sources. Fixes the bug I noticed while working on #169351 parent d50701d commit 28765f8
File tree
4 files changed
+65
-17
lines changed- .changeset
- packages/svelte
- src/internal/client/reactivity
- tests/runtime-runes/samples/async-resolve-stale
4 files changed
+65
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
345 | 348 | | |
346 | 349 | | |
347 | | - | |
| 350 | + | |
348 | 351 | | |
349 | 352 | | |
350 | 353 | | |
351 | | - | |
| 354 | + | |
352 | 355 | | |
353 | 356 | | |
354 | 357 | | |
355 | 358 | | |
356 | 359 | | |
357 | | - | |
| 360 | + | |
358 | 361 | | |
359 | 362 | | |
360 | | - | |
361 | | - | |
362 | | - | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
363 | 366 | | |
364 | | - | |
365 | | - | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
366 | 372 | | |
367 | 373 | | |
368 | | - | |
369 | | - | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
370 | 385 | | |
371 | 386 | | |
372 | 387 | | |
| |||
621 | 636 | | |
622 | 637 | | |
623 | 638 | | |
624 | | - | |
| 639 | + | |
| 640 | + | |
625 | 641 | | |
| 642 | + | |
626 | 643 | | |
627 | | - | |
| 644 | + | |
628 | 645 | | |
629 | 646 | | |
630 | 647 | | |
631 | 648 | | |
632 | 649 | | |
633 | | - | |
634 | | - | |
| 650 | + | |
| 651 | + | |
635 | 652 | | |
636 | 653 | | |
637 | 654 | | |
638 | 655 | | |
639 | 656 | | |
640 | 657 | | |
641 | 658 | | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
642 | 679 | | |
643 | 680 | | |
644 | 681 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
174 | 181 | | |
175 | 182 | | |
176 | 183 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
| 23 | + | |
25 | 24 | | |
26 | 25 | | |
0 commit comments