Skip to content

Conversation

@bosschaert
Copy link
Contributor

Description

Store the current prosemirror document in the YDoc under prosemirror-${guid} instead of the previous prosemirror key. A new prosemirror document gets a new GUID, even if it was stored in the same location as where a previous document used to live. This means that if there was an old editor open somewhere, that is editing a document that has since been deleted, these edits are then ignored.

The property prosemirror-guids contains an array of GUIDs with timestamps. Only the newest timestamp is active, any older guids on that array are not active any more. This array is often scrubbed, so deleted documents on the same location generally don't appear in the prosemirror-guids at all any more.

When creating a fresh new document in the editor, it creates a new GUID for it, using crypto.randomUUID()
When editing an existing document, the GUID of that document is returned from the HEAD request in the x-da-id header. So we can set that to the prosemirror-${guid} in that case.

Requires adobe/da-collab#88
Requires existing open browser DA editors to be refreshed.

Related Issue

#378

How Has This Been Tested?

  • Extended Playwright test

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

…eted documents

Store the current prosemirror document in the YDoc under prosemirror-${guid} instead of the previous prosemirror key.
A new prosemirror document gets a new GUID, even if it was stored in the same location as where a previous document used to live. This means that if there was an old editor open somewhere, that is editing a document that has since been deleted, these edits are then ignored.

The property prosemirror-guids contains an array of GUIDs with timestamps. Only the newest timestamp is active, any older guids on that array are not active any more. This array is often scrubbed, do deleted documents on the same location often don't appear in the prosemirror-guids at all any more.

When creating a fresh new document in the editor, create a new GUID for it, using crypto.randomUUID()
When editing an existing document, the GUID of that document is returned from the HEAD request in the x-da-id header. So we can set that to the prosemirror-${guid} in that case.

Requires existing open browser DA editors to be refreshed.
@aem-code-sync
Copy link

aem-code-sync bot commented Sep 6, 2025

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

@bosschaert
Copy link
Contributor Author

Playwright tests should pass once adobe/da-collab#88 is merged.

@aem-code-sync aem-code-sync bot temporarily deployed to pmguid2 September 7, 2025 16:54 Inactive
Updated Prosemirror tests to cover this case.
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