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

Popover attempts to resize when unmounted #3141

Closed
will-hart opened this issue Nov 10, 2018 · 4 comments
Closed

Popover attempts to resize when unmounted #3141

will-hart opened this issue Nov 10, 2018 · 4 comments

Comments

@will-hart
Copy link

Environment

  • Package version(s):
"@blueprintjs/core": "^3.8.0",
"@blueprintjs/datetime": "^3.3.1",
"@blueprintjs/icons": "^3.3.0"`
  • Browser and OS versions: Chrome 70.0.3538.102, Win 10 Home

Steps to reproduce

It's a little hard to replicate, but could be related to using lazy and Suspense to import Components asynchronously.

  1. Open an Overlay elsewhere on the page

The error being thrown is from a Popover that isn't currently open, on the other side of the window from where the mouse is.

Actual behavior

An exception is thrown by the Popover:

Uncaught Error: Unable to find node on an unmounted component.
    at invariant (29.chunk.js:86295)
    at findCurrentFiberUsingSlowPath (29.chunk.js:90628)
    at findCurrentHostFiber (29.chunk.js:90640)
    at findHostInstanceWithWarning (29.chunk.js:106349)
    at findDOMNode (29.chunk.js:106869)
    at ResizeSensor.componentDidUpdate (29.chunk.js:10535)
    at commitLifeCycles (29.chunk.js:102963)
    at commitAllLifeCycles (29.chunk.js:104384)
    at HTMLUnknownElement.callCallback (29.chunk.js:86385)
    at Object.invokeGuardedCallbackDev (29.chunk.js:86434)
    at invokeGuardedCallback (29.chunk.js:86488)
    at commitRoot (29.chunk.js:104589)
    at completeRoot (29.chunk.js:106120)
    at performWorkOnRoot (29.chunk.js:106043)
    at performWork (29.chunk.js:105948)
    at performSyncWork (29.chunk.js:105922)
    at interactiveUpdates$1 (29.chunk.js:106210)
    at interactiveUpdates (29.chunk.js:88505)
    at dispatchInteractiveEvent (29.chunk.js:91319)

The above error occurred in the <Blueprint3.ResizeSensor> component:
    in Blueprint3.ResizeSensor (created by InnerReference)
    in InnerReference (created by Context.Consumer)
    in Reference (created by Blueprint3.Popover)
    in span (created by Blueprint3.Popover)
    in Manager (created by Blueprint3.Popover)
    in Blueprint3.Popover (at TopButton.js:20)
    ... more lines of my code

Expected behavior

No exception is thrown

Possible solution

the ResizeSensor should check if it is mounted before running the callback here https://github.com/palantir/blueprint/blob/develop/packages/core/src/components/resize-sensor/resizeSensor.tsx#L69.

@will-hart
Copy link
Author

will-hart commented Nov 11, 2018

I think I've been able to replicate here - https://codesandbox.io/s/ojpmrxynxy

Basically the top level Suspense component seems to be the issue. In my case there is a suspense component wrapping the router.

EDIT this could be a regression in React 16.6.1, reverting to 16.6.0 seems to help.

@giladgray
Copy link
Contributor

@will-hart can you confirm if this issue is related to Blueprint code? or if it is indeed a 16.6.1 regression?

@will-hart
Copy link
Author

Looks like it might be a react issue, its being discussed in the linked issue facebook/react#14188

@giladgray
Copy link
Contributor

ok cool thanks for checking i'm going to close this issue as it's not on blueprint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants