joshwnj / joshwnj/react-visibility-sensor

Console.error logged when running component from inside react-test-renderer

Open
#131 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.3k
Forks
192
PR merge metrics
No merged PRs in 30d

Description

To reproduce, add the react-visibility-sensor to a component then test that component from inside react-test-render and you'll see this console error in the log.

React version 16.4.2
VisibilitySensor version: 4.1
```
Invariant Violation: Unable to find node on an unmounted component.

at invariant (node_modules/fbjs/lib/invariant.js:42:15)
at findCurrentFiberUsingSlowPath (node_modules/react-dom/cjs/react-dom.development.js:3779:30)
at findCurrentHostFiber (node_modules/react-dom/cjs/react-dom.development.js:3887:23)
at findHostInstance (node_modules/react-dom/cjs/react-dom.development.js:16825:19)
at Object.findDOMNode (node_modules/react-dom/cjs/react-dom.development.js:17311:12)
at Object.componentDidMount (node_modules/react-visibility-sensor/visibility-sensor.js:109:26)
at Object.chainedFunction [as componentDidMount] (node_modules/create-react-class/factory.js:665:11)
at commitLifeCycles (node_modules/react-cosmos-telescope/node_modules/react-test-renderer/cjs/react-test-renderer.development.js:7019:22)
```

Here's a snippet of my component code:
```
{({ isVisible }) => (

```

See this underlying issue in React for more information:
https://github.com/facebook/react/issues/7371

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.