Skip to content

fix(core): make content taxonomy terms locale-aware in the editor#1224

Draft
scottbuscemi wants to merge 1 commit into
mainfrom
fix/1218-locale-aware-tags
Draft

fix(core): make content taxonomy terms locale-aware in the editor#1224
scottbuscemi wants to merge 1 commit into
mainfrom
fix/1218-locale-aware-tags

Conversation

@scottbuscemi
Copy link
Copy Markdown
Contributor

@scottbuscemi scottbuscemi commented May 29, 2026

Closes #1218.

Problem

Applying a localized tag to a post showed and applied every locale variant of the tag to each translation, rather than the variant for the entry's own locale (similar root cause to #1198).

Fix

The storage model is already correct (assignment stored against the per-locale content row; the term's translation_group spans locales). The bug was on the read side — the terms endpoint never passed a locale, so getTermsForEntry returned every variant.

  • Core: /content/:collection/:id/terms/:taxonomy now derives the entry's locale server-side (not client-spoofable) and passes it to getTermsForEntry on both GET and POST-response reads.
  • Admin: TaxonomySidebar/ContentEditor thread the entry locale through fetch/save calls and include it in the React Query keys so switching translations refetches.
  • No schema/migration changes; write path untouched.

Testing

  • pnpm lint:quick clean; emdash + @emdash-cms/admin typecheck pass.
  • Added packages/core/tests/integration/taxonomies/taxonomy-locale-terms.test.ts (describeEachDialect) — confirmed failing before the fix (route returned both en+fr variants), passing after. SQLite ran locally (4 tests); Postgres runs in CI.

Manual verification

  1. Create a tag with EN + FR translations.
  2. Create EN content, add the tag; create its FR translation.
  3. Expect each translation to show/apply only its own locale's tag variant.

Try this PR

Open a fresh playground →

A full working EmDash site, deployed from this branch. Each visit gets its own session-scoped sandbox: no login needed and no shared state. Try the admin, edit content, hit the public site.

Tracks fix/1218-locale-aware-tags. Updated automatically when the playground redeploys.

Term assignments are stored against the per-locale content row while a
term's translation_group spans every locale, so resolving terms for an
entry must filter by the entry's locale. The terms endpoint now derives
the entry locale server-side and passes it to getTermsForEntry, and the
admin TaxonomySidebar threads the entry locale through its fetch/save
calls and React Query keys. Previously a localized post showed and
applied every locale variant of a tag. Closes #1218.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 29, 2026

🦋 Changeset detected

Latest commit: 3e948e2

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

This PR includes changesets to release 14 packages
Name Type
emdash Patch
@emdash-cms/admin Patch
@emdash-cms/cloudflare Patch
@emdash-cms/sandbox-workerd Patch
@emdash-cms/fixture-perf-site Patch
@emdash-cms/perf-demo-site Patch
@emdash-cms/cache-demo-site 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/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

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 29, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
docs 3e948e2 May 29 2026, 10:20 PM

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 29, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-demo-cache 3e948e2 May 29 2026, 10:22 PM

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 29, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-playground 3e948e2 May 29 2026, 10:22 PM

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 29, 2026

Open in StackBlitz

@emdash-cms/admin

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

@emdash-cms/auth

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

@emdash-cms/blocks

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

@emdash-cms/cloudflare

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

emdash

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

create-emdash

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

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

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

@emdash-cms/x402

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

@emdash-cms/plugin-ai-moderation

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

@emdash-cms/plugin-atproto

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

@emdash-cms/plugin-audit-log

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

@emdash-cms/plugin-color

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

@emdash-cms/plugin-embeds

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

@emdash-cms/plugin-forms

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

@emdash-cms/plugin-webhook-notifier

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

commit: 3e948e2

@github-actions
Copy link
Copy Markdown
Contributor

PR template validation failed

Please fix the following issues by editing your PR description:

  • This PR does not use the required PR template. Please edit the description to use the PR template. Copy it into your PR description and fill out all sections.

See CONTRIBUTING.md for the full contribution policy.

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.

Bug - Tags - Tags are not locale aware

1 participant