-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[v5] [core] feat: remove @juggle/resize-observer in favor of native API #6234
[v5] [core] feat: remove @juggle/resize-observer in favor of native API #6234
Conversation
@@ -72,7 +71,8 @@ export class ResizeSensor extends AbstractPureComponent<ResizeSensorProps> { | |||
|
|||
private prevElement: HTMLElement | undefined = undefined; | |||
|
|||
private observer = new ResizeObserver(entries => this.props.onResize?.(entries)); | |||
private observer = | |||
globalThis.ResizeObserver != null ? new ResizeObserver(entries => this.props.onResize?.(entries)) : undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure if this is the best way to make things work correctly in an isomorphic setting, but it seemed reasonable to me and got the tests to pass locally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems fine
Nice, this sounds like a good idea. Just in time for v5.0, I'm about to cut the stable release this week. I'm working on the |
Additional note: it sounds like the caveats listed here in "Switching between native and polyfilled versions" don't apply to us since we don't actually use any of the |
Oops, sorry for targeting the wrong branch, thanks for taking care of that and merging! |
Fixes #6233
Checklist
Changes proposed in this pull request:
Removes the use of the
@juggle/resize-observer
polyfill in favor of directly using the native API.Reviewers should focus on:
Is the code to support isomoprhic rendering okay?
Screenshot
N/A