Skip to content

Commit c51853f

Browse files
committed
fix: 🎨 made result of itemCreator easire to reason about the reactivity
1 parent bb9628d commit c51853f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/createVirtualizedList.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ export function createVirtualizedList<T extends Primitive | ObjectWithKey>(args:
234234

235235
const itemWrapper = (itemCreator: (args: ItemArgs<T>) => any, trackChanges = false) =>
236236
(virtualItem: VirtualItem, virtualItemIndex: () => number) => {
237-
const createItem = () => {
237+
const createItem = createMemo(() => {
238238
const itemData = data()[virtualItem.index]
239239
const style = {
240240
position: 'absolute',
@@ -268,9 +268,9 @@ export function createVirtualizedList<T extends Primitive | ObjectWithKey>(args:
268268
}
269269

270270
return itemCreator(itemArgs)
271-
}
271+
})
272272

273-
return trackChanges ? createMemo(createItem)() : untrack(createItem)
273+
return trackChanges ? createItem() : untrack(createItem)
274274
}
275275

276276
return {

0 commit comments

Comments
 (0)