Skip to content

Commit

Permalink
fix: calling useWindowVirtulizer reset's page scroll to 0 (#566)
Browse files Browse the repository at this point in the history
If a user scrolls the page before `useWindowVirtualizer` is called, the scroll position will be reset to 0. This fixes that issue.
  • Loading branch information
charkour authored Aug 29, 2023
1 parent 882aed1 commit 18f4018
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/virtual-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export const measureElement = <TItemElement extends Element>(
export const windowScroll = <T extends Window>(
offset: number,
{
adjustments = 0,
adjustments = window.scrollY,
behavior,
}: { adjustments?: number; behavior?: ScrollBehavior },
instance: Virtualizer<T, any>,
Expand Down

0 comments on commit 18f4018

Please sign in to comment.