Skip to content

scrollToIndex unreliable? #715

@Zerebokep

Description

@Zerebokep

Describe the bug
It seems using .scrollToIndex sometimes doesn't work, unfortunately I can't provide an example as I'm not be able to reproduce it, it only happens occasionally.

To Reproduce

virtualizer.scrollToIndex(messages.length - 1, {
        align: 'start',
      })

Expected behavior
scroll to the given index

Additional context
using it with requestAnimationFrame or settimeout seems to fix the issue:

    requestAnimationFrame(() =>
      virtualizer.scrollToIndex(messages.length - 1, {
        align: 'start',
      })
    )

p.s. I don't think it's an timing issue, as I'm using an effect which solely has messages as dependency, so the index should be correct.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions