From e870c0943839e577a6b7397f519b5d03295b0354 Mon Sep 17 00:00:00 2001 From: Mark VanLandingham Date: Tue, 29 Jun 2021 13:59:32 -0500 Subject: [PATCH] FIX: Do not call 'set' in destroyed directory table component (#13567) --- .../discourse/app/components/directory-table.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/directory-table.js b/app/assets/javascripts/discourse/app/components/directory-table.js index f9c03ba08f2..e92b8846e1f 100644 --- a/app/assets/javascripts/discourse/app/components/directory-table.js +++ b/app/assets/javascripts/discourse/app/components/directory-table.js @@ -57,7 +57,11 @@ export default Component.extend({ @action onHorizontalScroll(primary, replica) { - if (this.lastScrollPosition === primary.scrollLeft) { + if ( + this.isDestroying || + this.isDestroyed || + this.lastScrollPosition === primary.scrollLeft + ) { return; } @@ -65,8 +69,10 @@ export default Component.extend({ if (!this.ticking) { window.requestAnimationFrame(() => { - replica.scrollLeft = this.lastScrollPosition; - this.set("ticking", false); + if (!this.isDestroying && !this.isDestroyed) { + replica.scrollLeft = this.lastScrollPosition; + this.set("ticking", false); + } }); this.set("ticking", true);