Repository navigation
fix(admin): allow publication-date retry after a conflict - #3491
Conversation
🦋 Changeset detectedLatest commit: 20106ce 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 |
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://codex-fix-publication-date-conflict.try.emdashcms.com, https://codex-fix-publication-date-conflict-emdash-playground.emdash-cms.workers.dev (commit 20106ce)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
@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-loader
@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: |
There was a problem hiding this comment.
This is a focused, low-risk bug fix for the admin publication-date conflict retry flow. The approach is sound: it special-cases a date-only retry by threading an opt-in flag through ContentEditor.runScheduleChange and ContentEditPage.serializeEditorSave, while preserving the existing conflict guard and save queue whenever the editor has pending content changes. That matches the PR goal of preventing a date retry from overwriting another writer’s content.
What I checked:
- Read the full diff and the changed sections of
ContentEditor.tsx,router.tsx, andpackages/admin/tests/published-at-rev.test.tsx. - Traced the conflict/recovery flow (
hasSaveConflict,conflictedEntryIdRef,recoverFromSaveConflict,publishedAtMutation) to confirm the retry uses the recovered revision token and does not send content data when there are no unsaved changes. - Verified the gate in
ContentEditor.runScheduleChangestill rejects whenhasPendingSaveRef.currentis true, even withallowUnmodifiedConflict: true. - Confirmed no new user-facing strings were added, so Lingui coverage is unaffected.
- Reviewed the changeset against
.changeset/README.md; the entry names the affected admin UI surface, identifies the user-visible problem, and is proportional for a patch fix.
Everything looks correct. The implementation is consistent with the existing code, the test now asserts the retry body carries no data, and I found no regressions or AGENTS.md violations.
What does this PR do?
Fixes the Browser Tests failure on main where a publication-date change cannot be retried after a 409 conflict. The editor fetches the latest revision token, but its conflict guard rejects the second date-only submission before it reaches the API.
Allow that retry only when the form has no unsaved content changes. Keep the save queue and conflict guard for content payloads, so a date retry cannot overwrite another writer's fields. The existing browser regression now also checks that the retry sends no content data.
Related: #2966, #3118. Main failure: https://github.com/emdash-cms/emdash/actions/runs/36242081870
Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runAI-generated code disclosure
Screenshots / test output
No visual or layout change. The browser regression exercises the conflict dialog, retries the date-only write with the recovered token, and verifies that no content fields are sent.
pnpm buildpnpm typecheckpnpm lintpnpm lint:quick;pnpm --silent lint:json | jq '.diagnostics | length'→0pnpm --dir packages/admin test --run tests/published-at-rev.test.tsx tests/publish-autosave-race.test.tsx→ 29 passed