ui icon indicating copy to clipboard operation
ui copied to clipboard

fix(performance): improve `useArrayProp` memoization

Open stipsan opened this issue 1 year ago • 1 comments

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

stipsan avatar Nov 11 '24 23:11 stipsan