A platform for community discussion. Free, open, simple.
FIX: prevent stale `cook()` results from overwriting DCookText output (#40400)
David Taylorb36973699e7a
diff --git a/frontend/discourse/app/ui-kit/d-cook-text.gjs b/frontend/discourse/app/ui-kit/d-cook-text.gjsindex 3f3d012e68d..04fc52b97e8 100644--- a/frontend/discourse/app/ui-kit/d-cook-text.gjs+++ b/frontend/discourse/app/ui-kit/d-cook-text.gjs@@ -20,7 +20,11 @@ export default class DCookText extends Component {@actionasync loadCookedText() {- const cooked = await cook(this.args.rawText);+ const rawText = this.args.rawText;+ const cooked = await cook(rawText);+ if (this.args.rawText !== rawText) {+ return;+ }this.cooked = cooked;}diff --git a/plugins/discourse-ai/spec/system/page_objects/components/ai_post_helper_menu.rb b/plugins/discourse-ai/spec/system/page_objects/components/ai_post_helper_menu.rbindex 68b3bf07d54..84cfc36b25d 100644--- a/plugins/discourse-ai/spec/system/page_objects/components/ai_post_helper_menu.rb+++ b/plugins/discourse-ai/spec/system/page_objects/components/ai_post_helper_menu.rb@@ -28,8 +28,7 @@ module PageObjectsenddef has_suggestion_value?(value)- # Bumped wait because of: MessageBus, typing animation, text cooking.- page.has_css?("#{SUGGESTION_SELECTOR}__text:not(.streaming)", text: value, wait: 10)+ page.has_css?("#{SUGGESTION_SELECTOR}__text:not(.streaming)", text: value)enddef suggestion_value