Skip to content

Conversation

@chriszarate
Copy link
Member

What?

Handle invalidated CRDT docs and apply updates correctly. Companion to Automattic/vip-real-time-collaboration#31

Key change:

Even if a document has been invalidated (either by an out-of-band update or by restoring a revision), it is still the correct starting point to apply our changes.

There is no distinction between a document that has been invalidated by an "out-of-band" update and a restored revision. Both are invalidated and treated identically.

Note this TODO:

This new state should be persisted to the entity record. This
will result in a "dirty" record, but if the user does not save the
record, then content can be duplicated as other users join the session
or refresh.

If we have high confidence in our hash validation / invalidation, then
we could persist the updated record automatically. Or we could use
awareness states to let the user know that the content has changed on
the server and prompt them to save.

@github-actions
Copy link

github-actions bot commented Sep 18, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: chriszarate <[email protected]>
Co-authored-by: ingeniumed <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link

@ingeniumed ingeniumed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works well, and now the invalidation of the doc from an out of band update is reflected right after a refresh

// we could persist the updated record automatically. Or we could use
// awareness states to let the user know that the content has changed on
// the server and prompt them to save.
handlers.editRecord( {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel like it's better to leave it as dirty, and let the user handle the save right now. Based on feedback and how the hash validation/invalidation turns out in testing we could issue the persist updated record action

Base automatically changed from improve/dedicated-get-initial-post-data to improve/raw-record-naming September 18, 2025 06:17
Base automatically changed from improve/raw-record-naming to improve/sync-constants September 18, 2025 06:17
Base automatically changed from improve/sync-constants to fix/merged-record-for-entity-creation September 18, 2025 06:17
Base automatically changed from fix/merged-record-for-entity-creation to release/vip-rtc-0.1.0 September 18, 2025 06:18
@ingeniumed ingeniumed merged commit c6e9d31 into release/vip-rtc-0.1.0 Sep 18, 2025
53 of 75 checks passed
@ingeniumed ingeniumed deleted the improve/revision-restoration branch September 18, 2025 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants