fix: use ResizeObserver global from parentNode realm to support case with multiple realms#82
Conversation
…with multiple realms
bvaughn
left a comment
There was a problem hiding this comment.
I'm pretty suck today so my brain isn't working so well.
Will this change still work with server rendering? I see you moved things around a bit, but can you confirm that you've tested to make sure it didn't regress?
This logic happens in
Yeah, can confirm that:
|
That's fair. (The issue the comment referred to is bvaughn/react-virtualized#41 FWIW) |
|
react-virtualized-auto-sizer@1.0.23 |
Thank you! |
…-auto-sizer to ^1.0.23 (#28408) 1. Bumps `react-virtualized-auto-sizer` to 1.0.23, which has a fix for cases with multiple realms - bvaughn/react-virtualized-auto-sizer#82 2. Removes `react-window` from react-devtools-shared/src/node_modules, now listed as dependency in `package.json` and bumped to 1.8.10 Tested: - Chrome extension - Standalone shell with RN
…-auto-sizer to ^1.0.23 (facebook#28408) 1. Bumps `react-virtualized-auto-sizer` to 1.0.23, which has a fix for cases with multiple realms - bvaughn/react-virtualized-auto-sizer#82 2. Removes `react-window` from react-devtools-shared/src/node_modules, now listed as dependency in `package.json` and bumped to 1.8.10 Tested: - Chrome extension - Standalone shell with RN
…-auto-sizer to ^1.0.23 (#28408) 1. Bumps `react-virtualized-auto-sizer` to 1.0.23, which has a fix for cases with multiple realms - bvaughn/react-virtualized-auto-sizer#82 2. Removes `react-window` from react-devtools-shared/src/node_modules, now listed as dependency in `package.json` and bumped to 1.8.10 Tested: - Chrome extension - Standalone shell with RN DiffTrain build for commit facebook/react@404ed92.
I am working on something for React DevTools, which requires us to start using
ResizeObserver. After bumping this package to version1.0.22, theonResizecallback has stopped being executed in valid cases for the browser extension.After some debugging, I've noticed that the
parentNode.ownerDocumentis different fromdocument, which means that the code runs in a different realm from whereparentNodewas defined.By running
I've checked

documentandResizeObserverinstances, this is the result:Essentially, this change is only about switching
ResizeObservertoparentNode.ownerDocument.defaultView.ResizeObserver.Happy to provide more context if needed, tried adding a test for it with some iframes, but this will probably take much more time than the change itself.