facebook / facebook/lexical

Bug: CollaborationPlugin's initialState can be undoed

Open
#7,110 0 comments 0 reactions 0 assignees View on GitHub
collab
Dominant language
TypeScript
Stars
23.9k
Forks
2.2k
Avg merge
1d 14h
Merged PRs (30d)
55

Description

It seems that if initialState is given to CollaborationPlugin and client didnt receive any content when syncing with backend it adds initialState to the editorState. Problem is that this initialState to editorState addition also creates new row to undoManager's undoStack and therefore can be undoed. It kinda feels strange to be able to undo initialState off.

Also as far as i know, this works differently compared to normal initialState of editor (without collab) where initialState is not part of the history stack and therefore cant be undoed.

It's kinda annoying in my own case where I give certain node layout to initialState. This layout shouldnt be edited in any way, but now user can still press undo and remove it completly. I have made patch file in my project to add clearHistory call after initialState has been set, but of course this would be better if it was supported by library itself.

Lexical version: 0.23.1

## The current behavior
CollaborationPlugin's initialState can be undoed

## The expected behavior
CollaborationPlugin's initialState should not be able to be undoed

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.