Open PP-Tom opened 2 months ago
My apologies here, closed the issue prematurely without waiting for the PR to be merged, it still hasnt!
Will review and get it merged this week
It also happens to me when I execute the find method with the Local API: although I specify "en-US", if the document doesn't exist, it returns the default locale document (which in my case is "it-IT").
This will be available in the next release, let us know if you encounter any issues with fallback locales and logic here.
🚀 This is included in version v3.0.0-beta.130
I tested with the following script
async function run() {
const payload = await getPayload({ config })
const pages = await payload.find({
collection: 'pages',
locale: 'en-US',
limit: 1
})
console.log(pages)
process.exit(0)
}
run().catch(console.error)
and if I specify the locale en-US I have still a document that doesn't exist in that locale.
{
docs: [
{
id: '66ceee6848cdfa7fb0544740',
title: undefined,
order: 0,
meta: [Object],
publishDate: '2024-08-28T09:30:04.240Z',
author: [Object],
slug: undefined,
breadcrumbs: [],
_status: 'published',
createdAt: '2024-08-28T09:31:20.609Z',
updatedAt: '2024-11-04T14:26:49.266Z',
alternates: [Object],
collectionType: 'pages',
content: [Object]
}
],
totalDocs: 27,
limit: 1,
totalPages: 27,
page: 1,
pagingCounter: 1,
hasPrevPage: false,
hasNextPage: true,
prevPage: null,
nextPage: 2
}
My localization setting in payload.config is the following, I don't even have the 'en-US' locale (I removed to avoid the problem).
localization: {
locales: ['it-IT'],
defaultLocale: 'it-IT',
fallback: false,
}
This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.
Link to reproduction
No response
Environment Info
Describe the Bug
The defaultLocale value for localized fields is still returned even when the fallback value is set to false.
Reproduction Steps
In the frontend create a new page from your collection, give the defaultLocale a value, save and then switch to a different locale, check the API tab, you'll see the excerpt in the response.
Adapters and Plugins
mongo-db, s3-storage