From 691afa2593ce4104e64c1fdc18d99f6b45d87eed Mon Sep 17 00:00:00 2001 From: David Taylor Date: Thu, 16 Jun 2022 17:16:15 +0100 Subject: [PATCH] DEV: Handle emoji-picker and d-editor being destroyed simultaneously (#17109) --- .../javascripts/discourse/app/components/d-editor.js | 7 +++++++ .../discourse/app/templates/components/d-editor.hbs | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/app/components/d-editor.js b/app/assets/javascripts/discourse/app/components/d-editor.js index 37d570b2684..e669a5685c1 100644 --- a/app/assets/javascripts/discourse/app/components/d-editor.js +++ b/app/assets/javascripts/discourse/app/components/d-editor.js @@ -672,6 +672,13 @@ export default Component.extend(TextareaTextManipulation, { return true; }, + @action + onEmojiPickerClose() { + if (!(this.isDestroyed || this.isDestroying)) { + this.set("emojiPickerIsActive", false); + } + }, + actions: { emoji() { if (this.disabled) { diff --git a/app/assets/javascripts/discourse/app/templates/components/d-editor.hbs b/app/assets/javascripts/discourse/app/templates/components/d-editor.hbs index a8bad744e3f..f6ca96a8ea7 100644 --- a/app/assets/javascripts/discourse/app/templates/components/d-editor.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/d-editor.hbs @@ -74,5 +74,5 @@ isEditorFocused=isEditorFocused initialFilter=this.emojiFilter emojiSelected=(action "emojiSelected") - onEmojiPickerClose=(action (mut emojiPickerIsActive) false) + onEmojiPickerClose=onEmojiPickerClose }}