Conversation
…r DO migration Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move MSG_FLUSH_REQUEST/RESPONSE constants, decodeFlushAck, sendFlushRequest, waitForWsConnection, and forceSave out of index.js into a dedicated forcesave.js module. index.js re-exports nothing — it imports forceSave and attaches it to daContent. Test file updated to import forceSave from the new module path. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
auniverseaway
approved these changes
May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
When a user drags and drops an image in the DA editor, the upload is a two-step process:
If the user clicks Preview or Publish before that debounced save completes, the Cloudflare Durable Object (DO) backing the collab session may have migrated to a different machine in the meantime. The result: the preview/publish pipeline reads the old version of the document from da-admin — without the newly dropped image.
Solution
Before triggering a Preview or Publish action, the client now sends a WebSocket flush request (
MSG_FLUSH_REQUEST = 2) to da-collab, asking it to immediately flush any pending in-memory changes to da-admin. The client then:MSG_FLUSH_RESPONSE = 3.Dependencies
Changes
blocks/edit/prose/forcesave.js(new) — force-save protocol:MSG_FLUSH_REQUEST/RESPONSEconstants,decodeFlushAck,sendFlushRequest,waitForWsConnection, and the exportedforceSave(provider)function.blocks/edit/prose/index.js— importsforceSavefrom./forcesave.js; attachesdaContent.forceSaveat the end ofinitProse.blocks/edit/da-title/da-title.js— callsdaContent.forceSave()inhandleActionbeforesaveToAem, only for the prose edit view.test/unit/blocks/edit/prose/index.test.js— 4forceSaveunit tests; importsforceSavefrom./forcesave.js.Test plan
Test page: https://flushsav--da-live--adobe.aem.live/
npm test— 1355 passed, 0 failed)npm run lintpasses with no errors🤖 Generated with Claude Code