ui
ui copied to clipboard
fix(performance): improve `useArrayProp` memoization
Follows the principles detailed in this thread: https://github.com/facebook/react/issues/31330#issuecomment-2432947552
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