Use document GUID as prosemirror reference to avoid updating deleted documents #450
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Store the current prosemirror document in the YDoc under
prosemirror-${guid}
instead of the previousprosemirror
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 theprosemirror-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 theprosemirror-${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
Checklist: