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

feat: Remove react resize detector #2957

Merged

Conversation

tonydiaz
Copy link

@tonydiaz tonydiaz commented May 4, 2023

Contributes to #2744

V7 of ReactResizeObserver can result in the error shown in #2744 but the error appears to be a timing issue of some description.

The author fixed a similar looking issue in V8, but it persists in our storybook. In V9 there were more extensive changes that stopped our current usage working.

This PR removes ReactResizeObserver in favor of wrapping ResizeObserver (now standard) in a hook.

What did you change?

  • Removed react-resize-detector
  • Created useResizeObserver hook.
  • Checked it functioned as a replacement for all useResizeDetector hook How did you test and verify your work?
  • Storybook changing the size of things and adding new elements
  • Ran tests

How did you test and verify your work?

  • Storybook changing the size of things and adding new elements
  • Ran tests

@tonydiaz tonydiaz requested a review from a team as a code owner May 4, 2023 01:48
@netlify
Copy link

netlify bot commented May 4, 2023

Deploy Preview for carbon-for-ibm-products ready!

Name Link
🔨 Latest commit 22c2b9c
🔍 Latest deploy log https://app.netlify.com/sites/carbon-for-ibm-products/deploys/6453ffe18386100008efa365
😎 Deploy Preview https://deploy-preview-2957--carbon-for-ibm-products.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

lee-chase
lee-chase previously approved these changes May 4, 2023
Copy link
Member

@lee-chase lee-chase left a comment

Choose a reason for hiding this comment

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

Some familiar looking code, happy to approve. Noting it will result in the same storybook error until we move to Storybook 7.

Contributes to [carbon-design-system#2744](carbon-design-system#2744)

V7 of ReactResizeObserver can result in the error shown in [carbon-design-system#2744](carbon-design-system#2744) but the error appears to be a timing issue of some description.

The author fixed a similar looking issue in V8, but it persists in our storybook. In V9 there were more extensive changes that stopped our current usage working.

This PR removes ReactResizeObserver in favor of wrapping ResizeObserver (now standard) in a hook.

*What did you change?*
- Removed react-resize-detector
- Created useResizeObserver hook.
- Checked it functioned as a replacement for all useResizeDetector hook
*How did you test and verify your work?*
- Storybook changing the size of things and adding new elements
- Ran tests
@tonydiaz tonydiaz force-pushed the removeReactResizeDetector branch from 51a48c4 to 22c2b9c Compare May 4, 2023 18:56
Copy link
Member

@lee-chase lee-chase left a comment

Choose a reason for hiding this comment

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

Still looks good to me

@lee-chase lee-chase merged commit a3a89b0 into carbon-design-system:main May 4, 2023
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.

None yet

2 participants