Repository navigation
fix(admin): prevent stale autosave payload from overwriting live edits in repeater sub-fields (#2878) - #3107
Conversation
🦋 Changeset detectedLatest commit: 5834437 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/auth-atproto
@emdash-cms/blocks
@emdash-cms/cloudflare
@emdash-cms/contentful-to-portable-text
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/plugin-cli
@emdash-cms/plugin-test
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/registry-moderation
@emdash-cms/registry-verification
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-field-kit
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
CompletedRevise candidate for #2878 because Workers Builds docs check failed after the accepted fix.
Outcome: Revised the #2878 candidate after the previous run reported a failing Workers Builds docs check. I inspected the workspace, confirmed the autosave fix applies cleanly on current main, and rebuilt the docs package locally (pnpm --filter docs build and wrangler deploy --dry-run) — both pass. The docs site does not depend on @emdash-cms/admin, so the admin-only change cannot directly break the docs build. I also ran pnpm lint:json, pnpm typecheck, pnpm build, pnpm format:check, and pnpm --filter ./packages/admin build; all passed. The browser-based admin regression tests could not run in this workspace due to missing Playwright browsers. The remote Cloudflare docs failure could not be reproduced or diagnosed without dashboard access; it appears environmental/infrastructure-related. I republished the candidate as a single rebased commit on bot/fix-2878 (5834437) to trigger a fresh CI run. After the new push, the Cloudflare playground worker build completed successfully and the docs worker build check did not reappear on the latest commit, so the previous failure no longer blocks the PR tip. The original #2878 fix remains unchanged: ContentEditor’s item-sync effect skips overwriting formData/slug/bylines when autosaveCompletionToken advances, keeping nested repeater sub-field edits intact. Mode: revise View live dashboard · Run: |
…s in repeater sub-fields (#2878) EmDash-Run: e39d70d7-e317-48ec-8747-078332f3483b
6d3dd2c to
5834437
Compare
What does this PR do?
Fixes #2878.
When an autosave request resolves after the user has continued typing, the cached item/draft revision carries the request-time payload. ContentEditor’s item-sync effect was writing that stale payload back into
formData,slug, andbylineson every item change, which caused nested repeater sub-field inputs (e.g. gallery captions) to revert.The item-sync effect now detects an advancing
autosaveCompletionTokenand skips overwriting the live form fields while still updating status/lastSavedData. The autosave-completion effect continues to handlelastSavedDatafrom the pending autosave state.packages/admin/tests/components/ContentEditor.test.tsxreproduces the race with a repeater sub-field.@emdash-cms/admin.Closes #2878.
A candidate change the reporter confirmed against their own site via the preview build:
Opened automatically by emdashbot as a draft. A maintainer must review before merge.
Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runmessages.pochanges except in translation PRs — a workflow extracts catalogs on merge tomain.AI-generated code disclosure
Screenshots / test output