Skip to content

RTC: Editing a non-synced custom core-data entity leaves hasUndo() false #80722

Closed

Description

@gschaub

Description

When Real-Time Collaboration is active in the post editor, edits made to a custom core-data entity are accepted by core-data but are not added to the editor's Undo/Redo history.

The custom entity becomes dirty and contains the expected edits, but select( 'core' ).hasUndo() remains false and the editor's Undo button remains disabled.

The same custom entity edits create working undo levels when Real-Time Collaboration is disabled.

Dynamic Tables provides one reproducible example, but this behavior may affect any plugin that edits a separate custom core-data entity while Real-Time Collaboration is active.

Why this matters

WordPress plugins may use custom core-data entities for structured data that is semantically separate from post content.

These entities do not currently have a supported way to participate in Gutenberg RTC synchronization. Activating RTC for the post should not silently remove the normal core-data undo behavior for those entities.

Step-by-step reproduction instructions

Steps to reproduce

  1. Enable the Gutenberg plugin and Real-Time Collaboration under Settings → Writing.

  2. Register and load a custom core-data entity.

  3. Open a post in the block editor.

  4. Edit the custom entity using editEntityRecord():

    wp.data.dispatch( 'core' ).editEntityRecord(
        'dynamic-table-blocks',
        'table',
        tableId,
        edits
    );

    Do not pass undoIgnore or isCached, so both use their default false values.

  5. Inspect the resulting state:

    const core = wp.data.select( 'core' );
    
    console.log( {
        hasEdits: core.hasEditsForEntityRecord(
            'dynamic-table-blocks',
            'table',
            tableId
        ),
        edits: core.getEntityRecordEdits(
            'dynamic-table-blocks',
            'table',
            tableId
        ),
        hasUndo: core.hasUndo(),
        hasRedo: core.hasRedo(),
    } );

Actual result

The custom entity reports:

  • hasEdits: true
  • A non-empty edits object
  • hasUndo: false
  • hasRedo: false

The editor's Undo button remains disabled.

After disabling Real-Time Collaboration and reloading the editor, the same custom entity edit creates an undo level and Undo works.

Expected result

Activating RTC for a synced post should not silently remove undo history for non-synced custom core-data entities edited in the same editor.

Core-data should either:

  • preserve normal undo behavior for non-synced entities while RTC manages synced entities; or
  • provide a supported public compatibility mechanism for custom entities.

This report is about maintaining existing core-data Undo/Redo behavior. It does not require the custom entity itself to become collaboratively synchronized.

Additional context

The active RTC sync undo manager appears to replace the regular core-data undo manager for the editor session. The sync undo manager tracks synchronized entities, while addRecord() does not record ordinary edits for a non-synced custom entity.

This appears related to #79510, but that change addresses fallback when collaboration is unavailable. In this case, collaboration remains active for the post while the editor also edits a separate non-synced entity.

Screenshots, screen recording, code snippet

No response

Environment info

  • WordPress: 7.0.2
  • Gutenberg: 23.6.0
  • Theme: Twenty Twenty-Four
  • Browser: Chrome (current version)
  • Plugin Library: Dynamic Tables
  • Real-Time Collaboration: enabled
  • Custom entity:
    • Kind: dynamic-table-blocks
    • Name: table
    • Numeric record ID
    • Custom REST endpoint

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Activity

  1. added
    [Type] BugAn existing feature does not function as intended
    on Jul 26, 2026
  2. giteshsarvaiya commented on Jul 28, 2026

    @giteshsarvaiya
    Contributor

    While investigating this issue and the possibilities around it, I found a related but distinct bug. It produces a similar symptom (an accepted edit that undo does not cover), but I have not yet confirmed the exact cause, so I am noting it here separately.

    Steps to reproduce:

    1. Enable RTC and open a post that contains an Image block.
    2. Select the block, then click Crop in the block toolbar. This opens the media editor modal.
    3. In the modal, edit the Alt Text, Caption, or Description field, then close or confirm.
    4. Back in the post editor, click away from any text field, then press Ctrl+Z (or click the toolbar Undo button).
    5. Reopen the Crop modal on the same image.

    What you see: the caption reverts on the canvas, so Undo looks like it worked. But the modal still shows the alt text, caption, and description edits from step 3, unchanged.

    The attachment edit is also saved immediately when the modal closes (a direct REST request), before Undo is ever pressed, so by the time Undo runs, the change is already persisted server-side.

    I am still confirming the exact mechanism behind why undo does not cover the attachment's own edit. I will follow up once I have verified it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

[Feature] Real-time CollaborationPhase 3 of the Gutenberg roadmap around real-time collaboration[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions