Skip to content

Bug: SharedHistoryExtension doesn't work with external editor update #8623

@levensta

Description

@levensta

Lexical version: 0.45

Steps To Reproduce

  1. Create a decorator node containing a nested lexical instance with a registered SharedHistoryExtension.
  2. In the node component, register a listener for updating the nested editor instance. In the callback, trigger the update of the outer editor
  3. Write text in an external editor and in a nested editor
  4. Press Ctrl + Z in the nested editor

Link to code example: https://codesandbox.io/p/sandbox/5qg5ff

The current behavior

Shared history between editors doesn't work. Undo doesn't undo actions within a nested editor. But it correctly if the update has HISTORIC_TAG or you don't call the external editor update at all

The expected behavior

The shared history works regardless of whether the external editor is updated when the nested one is updated or not.

Impact of fix

Synchronizing updates between nested editors and the external one is important to trigger node serialization. But this pattern causes a non-obvious bug with a shared history

Metadata

Metadata

Assignees

No one assigned

    Labels

    historyHistoryPlugin. Undo-redo behavior

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions