From 9e98c02dd7c710d3a17754bc6fe1f4745a5edc5f Mon Sep 17 00:00:00 2001 From: David Taylor Date: Tue, 9 Jun 2020 23:01:07 +0100 Subject: [PATCH] FIX: Don't call cooked decorators in composer if cooked is unchanged If cooked is unchanged, ember will not re-render the preview area, so we should not re-run the post-processing decorators. This can cause issues when decorateCooked functions are not idempotent. --- app/assets/javascripts/discourse/app/components/d-editor.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/assets/javascripts/discourse/app/components/d-editor.js b/app/assets/javascripts/discourse/app/components/d-editor.js index 4917acc81cd..f979d7cc720 100644 --- a/app/assets/javascripts/discourse/app/components/d-editor.js +++ b/app/assets/javascripts/discourse/app/components/d-editor.js @@ -367,6 +367,9 @@ export default Component.extend({ if (this.isDestroyed) { return; } + + if (this.preview === cooked) return; + this.set("preview", cooked); schedule("afterRender", () => { if (this._state !== "inDOM") {