fix(core): include term description for flat taxonomies in getTaxonomyTerms()#1420
fix(core): include term description for flat taxonomies in getTaxonomyTerms()#1420swissky wants to merge 1 commit into
Conversation
…yTerms() The non-hierarchical branch dropped the already-fetched data column when mapping rows to TaxonomyTerm; only buildTree (hierarchical) parsed it. Closes emdash-cms#1419
|
All contributors have signed the CLA ✍️ ✅ |
🦋 Changeset detectedLatest commit: 5a4231a The changes in this PR will be included in the next version bump. This PR includes changesets to release 14 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 |
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
This is a clean, well-scoped bug fix. The approach is sound: getTaxonomyTerms() already fetched the data column, and the PR simply adds the same description extraction that the hierarchical branch (buildTree) and getTerm already used. The flat-taxonomy branch was the only place silently dropping it.
I checked:
- The one-line fix matches the existing pattern elsewhere in the module.
- The new unit test covers both flat and hierarchical taxonomies (the PR author verified the flat case fails without the fix).
- Locale filtering is unchanged and correct.
- A changeset is present and well-written.
- No SQL, auth, API route, or admin UI changes, so AGENTS.md conventions around those areas don't apply.
One suggestion: getEntryTerms in the same module also selects data via selectAll("taxonomies") but drops description when mapping rows. It's the exact same bug pattern, so it's worth a quick follow-up if entry-level term rendering also needs descriptions.
What does this PR do?
getTaxonomyTerms()already fetches thedatacolumn (selectAll()), but the non-hierarchical branch dropped it when mapping rows toTaxonomyTerm— only hierarchical taxonomies (viabuildTree) parseddescriptionout of it. Descriptions set in the admin UI were silentlyundefinedfor flat taxonomies.This adds the same one-line mapping the hierarchical path uses, plus a unit test covering both kinds of taxonomies (the flat case fails without the fix).
Context: we attach knowledge-graph links (e.g.
wikidata:Q380274) to term descriptions and render them assameAsin JSON-LD; flat taxonomies (tags, treatments) lost them.Closes #1419
Type of change
Checklist
pnpm typecheckpasses (packages/core;@emdash-cms/admin/marketplacebuilds fail on my machine on unrelated tooling, untouched by this PR)pnpm lintpasses (lint:quickclean)pnpm testpasses (targeted:packages/core/tests/unit/taxonomies/— 4 files, 48 tests green; new test red without the fix)pnpm formathas been runemdashpatch)AI-generated code disclosure
Screenshots / test output