@@ -57,9 +57,9 @@ export function index(_, i) {
57
57
* subsequent destruction. Used in each blocks
58
58
* @param {import('#client').EachItem[] } items
59
59
* @param {null | Node } controlled_anchor
60
- * @param {() => void } [callback]
60
+ * @param {Map<any, import("#client").EachItem> } items_map
61
61
*/
62
- function pause_effects ( items , controlled_anchor , callback ) {
62
+ function pause_effects ( items , controlled_anchor , items_map ) {
63
63
/** @type {import('#client').TransitionManager[] } */
64
64
var transitions = [ ] ;
65
65
var length = items . length ;
@@ -81,10 +81,11 @@ function pause_effects(items, controlled_anchor, callback) {
81
81
82
82
run_out_transitions ( transitions , ( ) => {
83
83
for ( var i = 0 ; i < length ; i ++ ) {
84
- destroy_effect ( items [ i ] . e , ! is_controlled ) ;
84
+ var item = items [ i ] ;
85
+ items_map . delete ( item . k ) ;
86
+ link ( item . prev , item . next ) ;
87
+ destroy_effect ( item . e , ! is_controlled ) ;
85
88
}
86
-
87
- if ( callback !== undefined ) callback ( ) ;
88
89
} ) ;
89
90
}
90
91
@@ -413,14 +414,7 @@ function reconcile(array, state, anchor, render_fn, flags, get_key) {
413
414
}
414
415
}
415
416
416
- pause_effects ( to_destroy , controlled_anchor , ( ) => {
417
- for ( var i = 0 ; i < destroy_length ; i += 1 ) {
418
- var item = to_destroy [ i ] ;
419
- items . delete ( item . k ) ;
420
- item . o . remove ( ) ;
421
- link ( item . prev , item . next ) ;
422
- }
423
- } ) ;
417
+ pause_effects ( to_destroy , controlled_anchor , items ) ;
424
418
}
425
419
426
420
if ( is_animated ) {
0 commit comments