From 6bbc8224951f241eac081cecc6de2e0d97a7c725 Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Wed, 23 Feb 2022 11:35:20 +0100 Subject: [PATCH] DEV: Don't check `this.element` in `@afterRender` (#16033) This would allow to use the decorator in tag-less components and in controllers. --- .../javascripts/discourse-common/addon/utils/decorators.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse-common/addon/utils/decorators.js b/app/assets/javascripts/discourse-common/addon/utils/decorators.js index 3439a4239f..c542822977 100644 --- a/app/assets/javascripts/discourse-common/addon/utils/decorators.js +++ b/app/assets/javascripts/discourse-common/addon/utils/decorators.js @@ -20,7 +20,7 @@ export function afterRender(target, name, descriptor) { const originalFunction = descriptor.value; descriptor.value = function () { schedule("afterRender", () => { - if (this.element && !this.isDestroying && !this.isDestroyed) { + if (!this.isDestroying && !this.isDestroyed) { return originalFunction.apply(this, arguments); } });