Skip to content

Popover attempts to resize when unmounted #3141

@will-hart

Description

@will-hart

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions