Add `useResizeObserver` and standardize usage
Resolves #2313
Description
Adds 2 new private packages:
@radix-ui/react-use-resize-observer- Extract
useResizeObserverfunctionality fromNavigationMenuandScrollAreainto reusable hook
- Extract
@radix-ui/react-use-debounce-callback- Extract
useDebounceCallbackfunctionality fromScrollAreainto reusable hook
- Extract
Use new hooks in useSize
Update instances of useResizeObserver and useDebounceCallback hooks in and NavigationMenu and ScrollArea
Package version changes affect all packages that use useSize or useResizeObserver internally
I don't think we need to add a new abstraction for this, at least not now. If you find a bug in any of our current implementations please open an issue and we can address them.
I don't think we need to add a new abstraction for this, at least not now. If you find a bug in any of our current implementations please open an issue and we can address them.
Could you clarify? I made this PR to resolve #2313 (linked in the PR description) which is an issue I made to describe a bug in the current implementation.
@Pearce-Ropion sorry, I missed the linked issue. Reopening!
Not sure if it's helpful, but I was encountering this issue from ScrollArea and managed to write a small-ish reproduction case. I'm sure it could be minimized a great deal more. The oddball Tailwind CSS classes are pulled from a larger application, but seem required for the error reproduction.
Repro: https://github.com/jasonm/dropdown-error-repro Discussion: https://github.com/vercel/next.js/discussions/74269#discussioncomment-11754678