fix(admin): surface create-content failures as an error toast - #2366
Open
edrpls wants to merge 1 commit into
Open
fix(admin): surface create-content failures as an error toast#2366edrpls wants to merge 1 commit into
edrpls wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: b713423 The changes in this PR will be included in the next version bump. This PR includes changesets to release 17 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-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@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: |
A rejected create (e.g. the 409 SLUG_CONFLICT when the auto-generated slug collides with an existing entry) was fully silent: createMutation had no onError, ContentNewPage had no toast manager, and the QueryClient has no global mutation error handler — the thrown Error (carrying the server's human-readable message) died in mutation state, the Save button reset, and the editor stayed on /new with zero feedback. Every other mutation in router.tsx surfaces failures; only the create path lacked a handler. The handler follows the settings-components pattern (useKumoToastManager + variant: "error") rather than Toast.useToastManager + type: "error": Kumo styles toast severity off variant (danger ring + error icon), while Base UI's type field is inert for styling — verified by rendering both. The regression test drives the real route with a mocked 409 SLUG_CONFLICT response and asserts the toast title, the server's message, the error affordance (the variant-driven toast icon), and that the router stays on /content/posts/new (fails unpatched: 1/14; passes patched: 14/14).
edrpls
force-pushed
the
fix/content-create-error-toast
branch
from
August 7, 2026 22:27
65d0be0 to
b713423
Compare
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.
What does this PR do?
A rejected content CREATE (e.g. the 409
SLUG_CONFLICTwhen the auto-generated slug collides with an existing entry) was fully silent:ContentNewPage.createMutationhas noonError, the page has no toast manager, and theQueryClienthas no global mutation error handler — so the thrownError(which already carries the server's human-readable message, viathrowResponseError) died in mutation state. The Save button reset and the editor stayed on/newwith zero feedback.Every other mutation in
router.tsxsurfaces failures (the edit page'shandleContentUpdateError→ "Failed to save" toast); this adds the equivalent handler to the create mutation. It follows the settings-components pattern (useKumoToastManager+variant: "error") rather thanToast.useToastManager+type: "error": Kumo styles toast severity offvariant(danger ring + error icon), while Base UI'stypefield is inert for styling — verified by rendering both. Strings are lingui-wrapped.The regression test drives the real route with a mocked 409
SLUG_CONFLICTresponse and asserts the toast title, the server's message, the error affordance (thevariant-driven toast icon — mutation-tested: droppingvariantfails the test), and that the router stays on/content/posts/new. Repro proof: fails unpatched (1/14), passes patched (14/14).Closes #2365
Type of change
Checklist
pnpm typecheckpasses (pnpm --filter @emdash-cms/admin typecheck— tsgo clean)pnpm lintpasses (type-aware oxlint on the changed files — clean; full-workspace lint not runnable on this machine, native build scripts unavailable)pnpm testpasses (or targeted tests for my change) —packages/adminvitest run tests/router.test.tsx: 14/14pnpm formathas been run (oxfmt— no reflow beyond the change)messages.pochanges except in translation PRs — a workflow extracts catalogs on merge tomain.AI-generated code disclosure
Screenshots / test output
Related follow-up (deliberately NOT in this PR — behavior change): the server's
generateUniqueSlugauto-suffixing never runs on normal creates because the admin always sends its client-side slug; omittingslugwhen the editor hasn't touched the field would make this collision a non-event. Flagged in #2365 for maintainer input.