-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
Cannot read property 'insertBefore' of null #6
Comments
Hmmm, I am struggling to think why this is. Could you please link me to the package that is consuming |
Or a sample project that I could use for debugging... :) |
I've just done a patch release which includes a fix for event listener race condition issues with unmounted components. It may help your case, please try and let me know. https://github.com/ctrlplusb/react-sizeme/releases/tag/v2.0.1 |
Seeing a similar issue as well. |
@tonyxiao any chance you could throw up a sample project for me? I'm more than happy to debug the issue. |
@tonyxiao I see you have forked and attempted to lazy load the resizer. Did it have any effect on the issue? |
@ctrlplusb yes that fixed the issue for me. I haven't figured out "why" it fixes the issue other than it does :P |
It crashes even at import time due to importing an external package |
WIll see if I can get a super clean example later. |
@tonyxiao awesome. :) Thanks for looking into this, I think I understand what is going on now. I had a look at the element-resizer source and there is definitely some DOM interaction that goes on just by instantiating it, so your fix is perfect. Looks like @emiloberg was on the right track too. Thanks for this gents. Don't worry about a sample project. I think we can move forward with the fix. Are you happy to send a PR? |
There was a patch release available for @tonyxiao heads up. :) |
Sweet, thank you @ctrlplusb for being so responsive! |
No probs. :) Thanks for your help! :) Just to be clear my recent change doesn't include your changes. Are you happy to proceed with a PR? I don't mind completing it either if you have your hands full. |
Yep created. #8 |
Thanks @tonyxiao! |
…. Thanks @tonyxiao! element-resize-detector package looks to be doing some interfacing with the DOM on import. This caused issues for users where the DOM was not ready yet.
As I work in an enterprise portal environment I have to deliver my React bundles in a quite unorthodox way.
I attach the Webpack build bundle to the window object. The
output
property of my Webpack config looks a little bit like this:I then pick up the component from the window object (e.g.
window.reactComponents.myStuff123
) and render the React component as such:However, as I add a package, which includes react-resizeme, to the window object I guess that it's immediately trying to set up some event listeners or such, because I get this error:
Is there any way of postponing the execution until it's actually rendered?
Loading example
A full example of the HTML and loading mechanisms looks like this:
The text was updated successfully, but these errors were encountered: