Skip to content

fix(admin): prevent stale autosave payload from overwriting live edits in repeater sub-fields (#2878) - #3107

Merged
ascorbic merged 1 commit into
mainfrom
bot/fix-2878
Sep 14, 2026
Merged

ascorbic merged 1 commit into
mainfrom
bot/fix-2878

Conversation

@emdashbot

@emdashbot emdashbot Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

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, and bylines on every item change, which caused nested repeater sub-field inputs (e.g. gallery captions) to revert.

The item-sync effect now detects an advancing autosaveCompletionToken and skips overwriting the live form fields while still updating status/lastSavedData. The autosave-completion effect continues to handle lastSavedData from the pending autosave state.

  • A regression test in packages/admin/tests/components/ContentEditor.test.tsx reproduces the race with a repeater sub-field.
  • Includes a patch changeset for @emdash-cms/admin.

Closes #2878.

A candidate change the reporter confirmed against their own site via the preview build:

npm i https://pkg.pr.new/emdash@bot/fix-2878

Opened automatically by emdashbot as a draft. A maintainer must review before merge.

Type of change

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: emdashbot + Kimi K2.7 Code

Screenshots / test output

@changeset-bot

changeset-bot Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5834437

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@emdash-cms/admin Patch
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/plugin-test Patch
@emdash-cms/sandbox-workerd Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
create-emdash Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds Patch

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

@pkg-pr-new

pkg-pr-new Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@3107

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@3107

@emdash-cms/auth-atproto

npm i https://pkg.pr.new/@emdash-cms/auth-atproto@3107

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@3107

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@3107

@emdash-cms/contentful-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/contentful-to-portable-text@3107

emdash

npm i https://pkg.pr.new/emdash@3107

create-emdash

npm i https://pkg.pr.new/create-emdash@3107

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@3107

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/@emdash-cms/plugin-cli@3107

@emdash-cms/plugin-test

npm i https://pkg.pr.new/@emdash-cms/plugin-test@3107

@emdash-cms/plugin-types

npm i https://pkg.pr.new/@emdash-cms/plugin-types@3107

@emdash-cms/registry-client

npm i https://pkg.pr.new/@emdash-cms/registry-client@3107

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/@emdash-cms/registry-lexicons@3107

@emdash-cms/registry-moderation

npm i https://pkg.pr.new/@emdash-cms/registry-moderation@3107

@emdash-cms/registry-verification

npm i https://pkg.pr.new/@emdash-cms/registry-verification@3107

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/@emdash-cms/sandbox-workerd@3107

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@3107

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@3107

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@3107

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@3107

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@3107

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@3107

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/@emdash-cms/plugin-field-kit@3107

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@3107

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@3107

commit: 5834437

@emdashbot

emdashbot Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Completed

Revise candidate for #2878 because Workers Builds docs check failed after the accepted fix.

  • Read AGENTS.md and inspect workspace state
  • Reproduce the failing docs build/check
  • Diagnose root cause of docs failure
  • Implement minimal revision/fix
  • Run verification checks
  • Publish candidate
  • Report result

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: e39d70d7-e317-48ec-8747-078332f3483b

…s in repeater sub-fields (#2878)

EmDash-Run: e39d70d7-e317-48ec-8747-078332f3483b
@ascorbic
ascorbic merged commit cba1135 into main Sep 14, 2026
55 checks passed
@ascorbic
ascorbic deleted the bot/fix-2878 branch September 14, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Repeated (nested repeater sub-field) input reverts to a stale autosave payload if its response arrives after further edits

1 participant