Skip to content

Commit

Permalink
Fix cache
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Aug 13, 2022
1 parent 4c4f40d commit 76135e8
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/rich-text/src/value.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@ export class RichTextValue {
}

toString() {
if ( ! this.toString.cached ) {
this.toString.cached = toHTMLString( {
value: { ...this },
multilineTag: this.multilineTag,
preserveWhiteSpace: this.preserveWhiteSpace,
if ( ! this.cache ) {
Object.defineProperty( this, 'cache', {
value: toHTMLString( {
value: { ...this },
multilineTag: this.multilineTag,
preserveWhiteSpace: this.preserveWhiteSpace,
} ),
} );
}
return this.toString.cached;

return this.cache;
}
}

Expand Down

0 comments on commit 76135e8

Please sign in to comment.