Unobserve status on unmount (#3851)
parent
7a96f422db
commit
36049c0096
|
@ -88,6 +88,16 @@ class Status extends ImmutablePureComponent {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillUnmount () {
|
||||||
|
if (!this.props.intersectionObserverWrapper) {
|
||||||
|
// TODO: enable IntersectionObserver optimization for notification statuses.
|
||||||
|
// These are managed in notifications/index.js rather than status_list.js
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.props.intersectionObserverWrapper.unobserve(this.props.id, this.node);
|
||||||
|
}
|
||||||
|
|
||||||
handleIntersection = (entry) => {
|
handleIntersection = (entry) => {
|
||||||
// Edge 15 doesn't support isIntersecting, but we can infer it
|
// Edge 15 doesn't support isIntersecting, but we can infer it
|
||||||
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12156111/
|
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12156111/
|
||||||
|
|
|
@ -37,6 +37,13 @@ class IntersectionObserverWrapper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unobserve (id, node) {
|
||||||
|
if (this.observer) {
|
||||||
|
delete this.callbacks[id];
|
||||||
|
this.observer.unobserve(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
disconnect () {
|
disconnect () {
|
||||||
if (this.observer) {
|
if (this.observer) {
|
||||||
this.observer.disconnect();
|
this.observer.disconnect();
|
||||||
|
|
Loading…
Reference in New Issue