Skip to content

Commit 07ed5c7

Browse files
committed
ensure state is up-to-date on inline-block restore
1 parent 6572bf4 commit 07ed5c7

File tree

1 file changed

+4
-0
lines changed
  • packages/richtext-lexical/src/features/blocks/client/componentInline

1 file changed

+4
-0
lines changed

Diff for: packages/richtext-lexical/src/features/blocks/client/componentInline/index.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,10 @@ export const InlineBlockComponent: React.FC<Props> = (props) => {
285285
// cleanup effect
286286
useEffect(() => {
287287
return () => {
288+
// If the component is unmounted, either via removeInlineBlock or via lexical itself,
289+
// we need to reset the cacheBuster to force a re-fetch of the initial state when it gets mounted again e.g. via lexical history undo.
290+
// Otherwise it would use a potentially outdated initial state, if the inline block was edited before it got removed.
291+
prevCacheBuster.current = -1
288292
abortAndIgnore(onChangeAbortControllerRef.current)
289293
}
290294
}, [])

0 commit comments

Comments
 (0)