Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
inokawa committed Jul 28, 2023
1 parent f732e62 commit 460e7a1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/react/VList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,6 @@ export const VList = forwardRef<VListHandle, VListProps>(
mode === "reverse",
cache
);
_store._subscribe(UPDATE_SCROLL_WITH_EVENT, () => {
onScroll[refKey] && onScroll[refKey](store._getScrollOffset());
});

return [
_store,
createResizer(_store, _isHorizontal),
Expand All @@ -209,9 +205,13 @@ export const VList = forwardRef<VListHandle, VListProps>(
const root = rootRef[refKey]!;
const unobserve = resizer._observeRoot(root);
const cleanup = scroller._initRoot(root);
const cleanupOnScroll = store._subscribe(UPDATE_SCROLL_WITH_EVENT, () => {
onScroll[refKey] && onScroll[refKey](store._getScrollOffset());
});
return () => {
unobserve();
cleanup();
cleanupOnScroll();
};
}, []);

Expand Down

0 comments on commit 460e7a1

Please sign in to comment.