File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
packages/svelte/src/internal/client/dom/blocks Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,10 @@ export class BranchManager {
4040
4141 #commit = ( ) => {
4242 var batch = /** @type {Batch } */ ( current_batch ) ;
43+
44+ // if this batch was made obsolete, bail
45+ if ( ! this . #batches. has ( batch ) ) return ;
46+
4347 var key = /** @type {Key } */ ( this . #batches. get ( batch ) ) ;
4448
4549 var onscreen = this . #onscreen. get ( key ) ;
@@ -64,6 +68,20 @@ export class BranchManager {
6468
6569 this . #batches. delete ( batch ) ;
6670
71+ for ( const [ b , k ] of this . #batches) {
72+ if ( b === batch ) break ;
73+
74+ const offscreen = this . #offscreen. get ( k ) ;
75+
76+ if ( offscreen ) {
77+ destroy_effect ( offscreen . effect ) ;
78+ this . #offscreen. delete ( k ) ;
79+ }
80+
81+ this . #batches. delete ( b ) ;
82+ }
83+
84+ // outro/destroy effects
6785 for ( const [ k , effect ] of this . #onscreen) {
6886 if ( k === key ) continue ;
6987
You can’t perform that action at this time.
0 commit comments