8000 Use document GUID as prosemirror reference to avoid updating deleted documents by bosschaert · Pull Request #450 · adobe/da-live · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Use document GUID as prosemirror reference to avoid updating deleted documents #450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

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, 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: adobe/da-admin#135 and adobe/da-collab#69
Also requires existing open browser DA editors to be refreshed.

Related Issue

Fixes: #378

How Has This Been Tested?

Locally with da-collab and da-live

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.

Copy link
aem-code-sync bot commented May 16, 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

The playwright tests will fail until the dependent PRs are merged.

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.

Deleting a document while having an editor open on it recreates it empty
1 participant
0