Skip to content
Snippets Groups Projects
Commit 9c03fd9c authored by unarist's avatar unarist Committed by Eugen Rochko
Browse files

Unobserve status on unmount (#4013)

This fixes a warning on status unmounting (e.g. deletion).

This also resets IntersectionObserverWrapper on disconnect to avoid `unobserve()` calls
which has bug in Edge.
parent 34c8a46d
No related branches found
No related tags found
No related merge requests found
......@@ -90,6 +90,10 @@ export default class Status extends ImmutablePureComponent {
}
componentWillUnmount () {
if (this.props.intersectionObserverWrapper) {
this.props.intersectionObserverWrapper.unobserve(this.props.id, this.node);
}
this.componentMounted = false;
}
......
......@@ -37,9 +37,18 @@ class IntersectionObserverWrapper {
}
}
unobserve (id, node) {
if (this.observer) {
delete this.callbacks[id];
this.observer.unobserve(node);
}
}
disconnect () {
if (this.observer) {
this.callbacks = {};
this.observer.disconnect();
this.observer = null;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment