Skip to content

fix(admin): unblock the saving of Content Types settings#601

Open
CacheMeOwside wants to merge 4 commits intoemdash-cms:mainfrom
CacheMeOwside:fix/save-content-types-settings
Open

fix(admin): unblock the saving of Content Types settings#601
CacheMeOwside wants to merge 4 commits intoemdash-cms:mainfrom
CacheMeOwside:fix/save-content-types-settings

Conversation

@CacheMeOwside
Copy link
Copy Markdown
Contributor

@CacheMeOwside CacheMeOwside commented Apr 16, 2026

What does this PR do?

Fixes the "Save Changes" button on the Content Type editor failing silently with a 400 error.

This bug affects saving any setting on the Content Type editor (label, description, URL pattern, features, SEO toggle, comments settings), and not just changes to "Enable comments" checkbox.

Closes #98

The cause

When we attempt to save the settings of a collection whose supports array contains "seo" (seeded into the DB by the demo seed.json files), the API's enum rejects it, because "seo" is not in the allowed list. 400 response is returned, and the admin UI silently fails. The save button appears to do nothing.

CleanShot.2026-04-16.at.17.35.46.mp4

The fix

I have stripped "seo" out of the supports array, so the Save payload no longer contains the value.

For a more permanent fix, if "seo" is no longer a supported value (since we are now using hasSeo), we might want to "seo" from the supports column on every row of the _emdash_collections table with a one-time migration. Then, we can remove "seo" from the demo seed files too.

I would love to get your opinion on this @MattieTK and @ascorbic.

Type of change

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

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation and pnpm locale:extract has been run (if applicable)
  • I have added a changeset (if this PR changes a published package)
  • New features link to an approved Discussion: https://github.com/emdash-cms/emdash/discussions/...

AI-generated code disclosure

  • This PR includes AI-generated code

Screenshots / test output

CleanShot.2026-04-16.at.18.42.09.mp4

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 16, 2026

🦋 Changeset detected

Latest commit: aaf9794

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

This PR includes changesets to release 9 packages
Name Type
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/admin Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
create-emdash 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
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 16, 2026

Open in StackBlitz

@emdash-cms/admin

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

@emdash-cms/auth

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

@emdash-cms/blocks

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

@emdash-cms/cloudflare

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

emdash

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

create-emdash

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

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

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

@emdash-cms/x402

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

@emdash-cms/plugin-ai-moderation

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

@emdash-cms/plugin-atproto

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

@emdash-cms/plugin-audit-log

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

@emdash-cms/plugin-color

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

@emdash-cms/plugin-embeds

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

@emdash-cms/plugin-forms

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

@emdash-cms/plugin-webhook-notifier

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

commit: aaf9794

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a silent failure when saving Content Type settings in the admin UI by preventing an invalid legacy supports value ("seo") from being sent to the API, and by surfacing save errors to the user.

Changes:

  • Strip legacy "seo" from supports in ContentTypeEditor so the update payload passes API enum validation.
  • Add an error toast on failed Content Type updates to avoid silent failures.
  • Add an E2E test that exercises toggling a setting + saving + reload persistence.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/admin/src/router.tsx Shows an error toast when the Content Type update mutation fails.
packages/admin/src/components/ContentTypeEditor.tsx Filters legacy "seo" out of supports (and out of change detection) to avoid 400s.
e2e/tests/content-types.spec.ts Adds an E2E regression test for saving Content Type settings.
.changeset/spotty-rockets-hunt.md Adds a patch changeset describing the fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread e2e/tests/content-types.spec.ts
Comment thread packages/admin/src/router.tsx
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.

Comments can't be disabled once enabled

2 participants