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

MenuOptionGroup virtualized (for large lists) #8087

Closed

Conversation

baptooo
Copy link

@baptooo baptooo commented Oct 23, 2023

Closes #7852

📝 Description

Add of new optional parameters to MenuOptionGroup props in order to enable a virtual scroll on menu for large lists.
For doing so, this PR adds a new dependency: https://tanstack.com/virtual/v3

⛳️ Current behavior (updates)

Today, large lists (100+ items) in Menu component causes important performance issues which leads into slow interface and hard-to-use UI.

🚀 New behavior

In this PR, the virtualized parameter will enable to render a virtualized list thanks to https://tanstack.com/virtual/v3 and will speed-up the menu

See it live on storybook

<MenuOptionGroup
+  virtualized={true}
+  virtualizedOptions={{
+    rowHeight: 40,
+    containerHeight: 200,
+  }}
  type="checkbox">
  ...
</MenuOptionGroup>

💣 Is this a breaking change (Yes/No):

No as these parameters are fully optional and not setting them will result into having the current behavior.

📝 Additional Information

Add of a dedicated story called PerformanceOptionGroup under Components / Overlay / Menu in Storybook.

@changeset-bot
Copy link

changeset-bot bot commented Oct 23, 2023

🦋 Changeset detected

Latest commit: 3981493

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@chakra-ui/menu Minor
@chakra-ui/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Oct 23, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
chakra-ui-storybook ✅ Ready (Inspect) Visit Preview Oct 23, 2023 4:07pm

@baptooo baptooo changed the title Feat/menu option group virtualized MenuOptionGroup virtualized (for large lists) Oct 23, 2023
.changeset/odd-snakes-fold.md Outdated Show resolved Hide resolved
@@ -46,7 +46,8 @@
"@chakra-ui/react-use-controllable-state": "workspace:*",
"@chakra-ui/react-use-outside-click": "workspace:*",
"@chakra-ui/react-use-update-effect": "workspace:*",
"@chakra-ui/shared-utils": "workspace:*"
"@chakra-ui/shared-utils": "workspace:*",
"@tanstack/react-virtual": "3.0.0-beta.65"

Choose a reason for hiding this comment

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

shouldn't we specify a looser version?

Copy link
Author

Choose a reason for hiding this comment

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

@segunadebayo
Copy link
Member

Thanks for working on this @baptooo. I appreciate the patience as well

We don't intend to support virtualization out of the box. I would recommend handling this in your userland code.

Thanks for understanding.

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

5 participants