contentful.js icon indicating copy to clipboard operation
contentful.js copied to clipboard

`withAllLocales` doesn't query on all locales.

Open votemike opened this issue 11 months ago • 7 comments

Expected Behavior

Querying with withAllLocales should query on all translations. E.G.

await client.withAllLocales.getEntries<
  TypePageSkeleton | TypePostSkeleton
>({
  content_type: 'page',
  'fields.url': url,
  include: 10,
  limit: 1,
});

Should return my results for any localised url.

Actual Behavior

The query mentioned above only works if querying url specified in the default locale language.

Possible Solution

Steps to Reproduce

Set up Contentful with a default language and a language that falls back to the default language. Create a model with a translatable URL field. Add an entry with with only a url in the default language Add an entry with with a url in both languages Query based on non-default url.

Context

I have several pages that can be in several languages. Sometimes I want all languages to use the same URL. Sometimes I want each language to have a unique URL. I want to retrieve the page by URL. I cannot pass the locale in to the query, as locales with no URL translation will not fallback to the default language url for querying purposes.

Environment

  • Language Version:
  • Package Manager Version:
  • Browser Version:
  • Operating System:
  • Package Version: 10.6.22
  • Which API are you using?:

votemike avatar Mar 28 '24 12:03 votemike