Skip to content

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

DEV: Handle emoji-picker and d-editor being destroyed simultaneously (#17109)

David Taylor691afa2593ce
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
}}