@@ -150,6 +150,17 @@ type RawDynamicScrollerView<TItem = unknown, TKey = KeyValue> = View<ItemWithSiz
150150
151151const SCROLL_MEASURE_IDLE_MS = 120
152152
153+ /**
154+ * Touch array slots so computed wrappers react to shallow list mutations such as
155+ * push, splice, reorder, or item replacement without deep-watching item fields.
156+ */
157+ function trackArrayShallowMutations < TItem > ( items : TItem [ ] ) {
158+ for ( let index = 0 ; index < items . length ; index ++ ) {
159+ // eslint-disable-next-line ts/no-unused-expressions
160+ items [ index ]
161+ }
162+ }
163+
153164/**
154165 * Resolve internal size-tracking state from raw recycle view.
155166 */
@@ -515,7 +526,11 @@ export function useDynamicScroller<TOptions extends UseDynamicScrollerOptions<an
515526 simpleArray : false ,
516527 } )
517528
518- const items = computed ( ( ) => toValue ( getOptions ( ) . items ) )
529+ const items = computed ( ( ) => {
530+ const currentItems = toValue ( getOptions ( ) . items )
531+ trackArrayShallowMutations ( currentItems )
532+ return currentItems
533+ } )
519534 const direction = computed < ScrollDirection > ( ( ) => getOptions ( ) . direction ?? 'vertical' )
520535 const el = computed ( ( ) => toValue ( getOptions ( ) . el ) )
521536 const before = computed ( ( ) => toValue ( getOptions ( ) . before ) )
@@ -941,6 +956,9 @@ export function useDynamicScroller<TOptions extends UseDynamicScrollerOptions<an
941956
942957 _applyingShiftAnchor = true
943958 scrollerEl . scrollTop = target
959+ // Keep the pooled window in sync immediately so prepend anchoring does not
960+ // expose one-frame overlaps while the native scroll event is still queued.
961+ recycleScroller . updateVisibleItems ( true )
944962 scrollerEl . dispatchEvent ( new Event ( 'scroll' ) )
945963 requestFrame ( ( ) => {
946964 _applyingShiftAnchor = false
@@ -1214,7 +1232,7 @@ export function useDynamicScroller<TOptions extends UseDynamicScrollerOptions<an
12141232 }
12151233
12161234 // Watchers
1217- watch ( items , ( nextItems , previousItems ) => {
1235+ watch ( ( ) => items . value . slice ( ) , ( nextItems , previousItems ) => {
12181236 const opts = getOptions ( )
12191237 const keyField = simpleArray . value ? null : opts . keyField
12201238 const nextKeys = getItemKeys ( nextItems , keyField )
0 commit comments