flushSync warning when using useVritualizer with initialOffset greater than available scroll

Open
#651 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript

Research direction

Start by running the linked CodeSandbox reproduction and inspect the useVirtualizer behavior when initialOffset exceeds the scrollElement's available scroll area. Trace where that condition leads to the flushSync warning, then verify the reproduction no longer emits errors or warnings when the offset is out of range.

Written by the indexing model from the issue text.

Description

Describe the bug

flushSync warning when calling useVirtualizer with initialOffset greater than available scroll.

Your minimal, reproducible example

https://codesandbox.io/p/devbox/virtualizer-repro-lk332q?file=%2Fsrc%2FApp.tsx

Steps to reproduce
  1. use useVirtualizer with initialOffset greater than the available scroll area in the scrollElement
Expected behavior

No errors/warning should happen.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

OS: Windows
Browser: Firefox 121.0.1 (64-bit), Chrome 121.0.6167.85

tanstack-virtual version

latest

TypeScript version

No response

Additional context

No response

Terms & Code of Conduct
  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
Dominant language
TypeScript
Stars
7.2k
Forks
495
Avg merge
23h 16m
Merged PRs (30d)
19

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from TanStack/virtual

All issues in TanStack/virtual

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.