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

fix(performance): improve useArrayProp memoization #1470

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

Conversation

stipsan
Copy link
Member

@stipsan stipsan commented Nov 11, 2024

Follows the principles detailed in this thread: facebook/react#31330 (comment)

While at it I cleaned up useArrayProp, which internally seems to never actually use defaultValue. Since the hook is exported I've added a compat hook in src/core/hooks/useArrayPropLegacy.ts so that third party libraries that make use of the useArrayProp(value, defaultValue) pattern continue working.
They'll get a deprecated warning though and tell them to migrate to useArrayProp(value ?? defaultValue).

This PR also takes care of the linter warning for useUnique inside src/core/utils/portal/portalProvider.tsx

Copy link

vercel bot commented Nov 11, 2024

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

Name Status Preview Comments Updated (UTC)
sanity-ui-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 11, 2024 11:05pm
sanity-ui-workshop ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 11, 2024 11:05pm

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.

1 participant