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

[Tabs] Wrap TabsList context creation in useMemo #37370

Merged
merged 2 commits into from
Jun 28, 2023

Conversation

michaldudak
Copy link
Member

The useCompoundParent and useTabsList return values' contexts were recreated on every call, possibly causing unnecessary rerenders of components that use these hooks. This PR wraps the creation of contexts in useMemo. The additional memory footprint won't be significant, as most of the context fields are already memoized.

@michaldudak michaldudak added component: tabs This is the name of the generic UI component, not the React module! package: base-ui Specific to @mui/base enhancement This is not a bug, nor a new feature labels May 22, 2023
@michaldudak michaldudak requested a review from mnajdova May 22, 2023 20:28
@mui-bot
Copy link

mui-bot commented May 22, 2023

Netlify deploy preview

https://deploy-preview-37370--material-ui.netlify.app/

Bundle size report

Details of bundle changes

Generated by 🚫 dangerJS against e9e168f

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label May 24, 2023
Copy link
Member

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

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

Makes sense!

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Jun 22, 2023
@michaldudak michaldudak enabled auto-merge (squash) June 22, 2023 21:55
@michaldudak michaldudak merged commit f8cb69b into mui:master Jun 28, 2023
17 of 18 checks passed
@michaldudak michaldudak deleted the memoize-compound-context branch June 28, 2023 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tabs This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature package: base-ui Specific to @mui/base
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants