Repository navigation
fix(core): respect seeded collections for default taxonomies - #3025
scottbuscemi wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 7d8fc6f 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-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: |
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://fix-seed-default-taxonomy-collections.try.emdashcms.com, https://fix-seed-default-taxonomy-collections-emdash-playground.emdash-cms.workers.dev (commit 7d8fc6f)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
There was a problem hiding this comment.
This is the right fix for the reported problem: with onConflict: "skip" (the default), EmDash was never updating the factory category and tag taxonomy definitions, so templates and custom sites that associate those taxonomies with collections other than posts ended up with empty taxonomy filters. The change narrowly targets those untouched built-in rows and preserves normal skip behavior once a definition has been deliberately configured.
What I checked:
packages/core/src/database/migrations/006_taxonomy_defs.tscreates the built-incategoryandtagdefinitions with exactly the IDs, labels, hierarchy flags, andcollectionsvalue the new heuristic expects.apply.tsnow updates only when the existing row is still the untouched factory default (isUntouchedBuiltInTaxonomy) and only inskip/updatepaths;onConflict: "error"still throws as before.- The integration test covers both
categoryandtag, verifies the initial override, and verifies that a second seed with the factory defaults is skipped (i.e., the definition is now "configured"). - The changeset is user-facing and proportional for a patch.
- No logged-out hot-path changes, no SQL injection surface, no missing locale filters, no Lingui/RTL/UI concerns.
I did not find any blocking bugs. One maintainability note: the factory-default values are duplicated between migration 006_taxonomy_defs.ts and the new heuristic in apply.ts. That is flagged as a suggestion.
| /** Pattern to collapse multiple hyphens */ | ||
| const MULTIPLE_HYPHENS_PATTERN = /-+/g; | ||
|
|
||
| function isUntouchedBuiltInTaxonomy(definition: { |
There was a problem hiding this comment.
[suggestion] This function duplicates the factory defaults already defined in packages/core/src/database/migrations/006_taxonomy_defs.ts (ids, labels, hierarchical, and the `[
|
This PR has been inactive for 14 days. It will be closed automatically in 7 days if there is no further activity. If you're still working on this, please push an update or leave a comment. |
|
Superseded by #3355, which implements seeded replacement of untouched built-in taxonomies with the fuller accounting, options, documentation, and tests. |
What does this PR do?
Allows a site's initial seed to replace the untouched built-in
categoryandtagtaxonomy definitions created by migrations. This ensures templates and custom sites can associate those taxonomies with collections other thanposts, so taxonomy filtering returns the seeded collection's content.Normal
onConflict: "skip"behavior is preserved after a built-in definition has been configured.Reported directly; no issue.
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
Not applicable; no UI changes.
pnpm --filter emdash exec vitest run tests/integration/seed-on-conflict.test.ts(23 tests passed)