Skip to content

A platform for community discussion. Free, open, simple.

FIX: Do not call 'set' in destroyed directory table component (#13567)

Mark VanLandinghame870c0943839
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);