joshwnj / joshwnj/react-visibility-sensor

findDOMNode was called on an unmounted component

Open
#66 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.3k
Forks
192
PR merge metrics
No merged PRs in 30d

Description

We're using react-visibilty-sensor to animate pictures on our home page, and we use [https://sentry.io](sentry.io) to monitor errors on client side.

We've got multiple reports on the following issue: "Invariant Violation: findDOMNode was called on an unmounted component"
This happens in visibility-sensor.js, there:
```
/**
* Check if the element is within the visible viewport
*/
check: function () {
var el = ReactDOM.findDOMNode(this);
var rect;
var containmentRect;
```
(on Chrome mobile 56.0.2924)

I can't reproduce on my computer, but looks related to the tabs "Je suis propriétaire / Je suis acquéreur".

What I understand from your code is that at the end there's no real issue, because if you can't find the node you do nothing. But that warning is a bit annoying.

I presume the issue comes from a last `check()` call by "debounceCheck", because you don't clear the setTimeout l.21 on `stopWatching`

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.