Fix (code): fallbackLocale entry not returned#1693
Conversation
🦋 Changeset detectedLatest commit: af098ee The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 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 |
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
The approach is directionally right: Astro's getLiveEntry can surface a missing locale-specific entry as LiveEntryNotFoundError, and the fallback loop should not short-circuit on the first not-found. However, the fix as written is incomplete, untested, and has an AGENTS.md-convention issue in its changeset.
I read packages/core/src/query.ts, src/i18n/config.ts, and the EntryResult contract, and confirmed there are no existing tests covering fallback-locale entry resolution. The function's own docs say entry: null if not found, and error is only for actual errors (DB failures, etc.). The current PR satisfies that for intermediate locales but still returns the not-found error at the end of the fallback chain, which breaks the documented contract. A simpler and more correct fix is to always continue on LiveEntryNotFoundError and let the existing end-of-loop returns produce entry: null.
Headline: fix the fallback overflow for the final locale, add a reproducing test, and rewrite the changeset to be user-facing.
@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/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: |
What does this PR do?
Added condition to check if
getLiveEntryerror (invoked bygetEmDashEntry) is Astro'sLiveEntryNotFoundErrorinside localeChain loop. This make sure to check every possible language chain before returning emptyentryfield.Closes #1679
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