DEV: Fix a call-after-destroy issue (#14923)
Intersection observer callback can be called after the component gets destroyed: ``` Assertion Failed: calling set on destroyed object: <@ember/component:ember6019>.docked = false at assert (ember:37774:17) at _set2 (ember:17304:46) at Class.set (ember:29529:29) at Class._intersectionHandler (discourse/app/components/topic-progress:135:16) at Backburner._run (ember:56389:25) at Backburner._join (ember:56365:21) at Backburner.join (ember:56082:19) at join (ember:42874:28) at IntersectionObserver.eval (ember:42978:19) ```
This commit is contained in:
parent
140ef0ebe7
commit
827b6c99ae
|
@ -155,6 +155,10 @@ export default Component.extend({
|
|||
|
||||
@bind
|
||||
_intersectionHandler(entries) {
|
||||
if (!this.element || this.isDestroying || this.isDestroyed) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (entries[0].isIntersecting === true) {
|
||||
this.set("docked", true);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue