Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add enabled option to Virtualizer #724

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sxriff
Copy link

@sxriff sxriff commented May 5, 2024

@KevinVandy
Copy link
Member

I'm in favor of an enable/disable option. It would really help my MRT libraries.

@@ -328,6 +329,7 @@ export class Virtualizer<
options!: Required<VirtualizerOptions<TScrollElement, TItemElement>>
scrollElement: TScrollElement | null = null
targetWindow: (Window & typeof globalThis) | null = null
private enabled: boolean = true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need an instance variable, overall we should relay on scrollElement if it's null then everything should be reseted.

enabled={false} should be same as getScrollElement: () => null

@piecyk
Copy link
Collaborator

piecyk commented Jun 20, 2024

@sxriff after reading the PR refactored it bit to handle reseting scroll offset, measurementsCache etc it's bit tricky when we also want to handle the initialRect, initialOffset etc, checkout the #741

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants