Skip to content

Commit

Permalink
Fix cache
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed May 3, 2023
1 parent 25c51af commit edf956e
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 edf956e

Please sign in to comment.