@@ -132,6 +132,8 @@ export function each(node, flags, get_collection, get_key, render_fn, fallback_f
132132 var state = { flags, items : new Map ( ) , first : null } ;
133133
134134 var is_controlled = ( flags & EACH_IS_CONTROLLED ) !== 0 ;
135+ var is_reactive_value = ( flags & EACH_ITEM_REACTIVE ) !== 0 ;
136+ var is_reactive_index = ( flags & EACH_INDEX_REACTIVE ) !== 0 ;
135137
136138 if ( is_controlled ) {
137139 var parent_node = /** @type {Element } */ ( node ) ;
@@ -231,8 +233,14 @@ export function each(node, flags, get_collection, get_key, render_fn, fallback_f
231233
232234 if ( item ) {
233235 // update before reconciliation, to trigger any async updates
234- if ( ( flags & ( EACH_ITEM_REACTIVE | EACH_INDEX_REACTIVE ) ) !== 0 ) {
235- update_item ( item , value , i , flags ) ;
236+ if ( is_reactive_value ) {
237+ internal_set ( item . v , value ) ;
238+ }
239+
240+ if ( is_reactive_index ) {
241+ internal_set ( /** @type {Value<number> } */ ( item . i ) , i ) ;
242+ } else {
243+ item . i = i ;
236244 }
237245
238246 batch . skipped_effects . delete ( item . e ) ;
@@ -537,25 +545,6 @@ function reconcile(each_effect, array, state, anchor, flags, get_key) {
537545 }
538546}
539547
540- /**
541- * @param {EachItem } item
542- * @param {any } value
543- * @param {number } index
544- * @param {number } type
545- * @returns {void }
546- */
547- function update_item ( item , value , index , type ) {
548- if ( ( type & EACH_ITEM_REACTIVE ) !== 0 ) {
549- internal_set ( item . v , value ) ;
550- }
551-
552- if ( ( type & EACH_INDEX_REACTIVE ) !== 0 ) {
553- internal_set ( /** @type {Value<number> } */ ( item . i ) , index ) ;
554- } else {
555- item . i = index ;
556- }
557- }
558-
559548/**
560549 * @template V
561550 * @param {Node | null } anchor
0 commit comments