Skip to content

Fix (code): fallbackLocale entry not returned#1693

Open
manot40 wants to merge 5 commits into
emdash-cms:mainfrom
manot40:fix/getemdashentry-fix
Open

Fix (code): fallbackLocale entry not returned#1693
manot40 wants to merge 5 commits into
emdash-cms:mainfrom
manot40:fix/getemdashentry-fix

Conversation

@manot40

@manot40 manot40 commented Jul 1, 2026

Copy link
Copy Markdown

What does this PR do?

Added condition to check if getLiveEntry error (invoked by getEmDashEntry) is Astro's LiveEntryNotFoundError inside localeChain loop. This make sure to check every possible language chain before returning empty entry field.

Closes #1679

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 (if applicable). Do not include messages.po changes except in translation PRs — a workflow extracts catalogs on merge to main.
  • 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 — model/tool:

@changeset-bot

changeset-bot Bot commented Jul 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: af098ee

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

This PR includes changesets to release 16 packages
Name Type
emdash 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/do-demo-site Patch
@emdash-cms/do-solo-demo-site 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/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

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@manot40

manot40 commented Jul 1, 2026

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Jul 1, 2026
@manot40 manot40 marked this pull request as ready for review July 1, 2026 11:38
@github-actions github-actions Bot added the review/needs-review No maintainer or bot review yet label Jul 1, 2026

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread packages/core/src/query.ts Outdated
Comment thread packages/core/src/query.ts Outdated
Comment thread packages/core/src/query.ts Outdated
Comment thread .changeset/tender-rivers-admire.md Outdated
Comment thread packages/core/src/query.ts
@github-actions github-actions Bot added review/awaiting-author Reviewed; waiting on the author to respond and removed review/needs-review No maintainer or bot review yet labels Jul 1, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 1, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

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

@emdash-cms/auth

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

@emdash-cms/auth-atproto

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

@emdash-cms/blocks

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

@emdash-cms/cloudflare

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

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

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

emdash

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

create-emdash

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

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

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

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/@emdash-cms/plugin-cli@1693

@emdash-cms/plugin-types

npm i https://pkg.pr.new/@emdash-cms/plugin-types@1693

@emdash-cms/registry-client

npm i https://pkg.pr.new/@emdash-cms/registry-client@1693

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/@emdash-cms/registry-lexicons@1693

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/@emdash-cms/sandbox-workerd@1693

@emdash-cms/x402

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

@emdash-cms/plugin-ai-moderation

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

@emdash-cms/plugin-atproto

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

@emdash-cms/plugin-audit-log

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

@emdash-cms/plugin-color

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

@emdash-cms/plugin-embeds

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

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/@emdash-cms/plugin-field-kit@1693

@emdash-cms/plugin-forms

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

@emdash-cms/plugin-webhook-notifier

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

commit: af098ee

@github-actions github-actions Bot added size/M review/needs-rereview Author pushed changes since the last review and removed size/S review/awaiting-author Reviewed; waiting on the author to respond labels Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core cla: signed review/needs-rereview Author pushed changes since the last review size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Post entry not returning properly with fallback locale when Astro's i18n prefixDefaultLocale disabled.

2 participants