Skip to content

Commit

Permalink
FIX: Don't call cooked decorators in composer if cooked is unchanged
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
davidtaylorhq committed Jun 9, 2020
1 parent f67e7d2 commit 9e98c02
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/assets/javascripts/discourse/app/components/d-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down

0 comments on commit 9e98c02

Please sign in to comment.