Where clause in GraphQL query does not work on fallbackLocale
Link to reproduction
No response
Describe the Bug
When having a GraphQL Query that has a fallbackLocale specified and using a where clause to filter for specific checkbox value (in this case) the where selector does not work properly on the specified fallbackLocale.
fallbackLocale: en_DE
limit: 500
where: { showInOverview: { equals: true } }
Here I fallback to a locale where at least one document has the showInOverview value set to true. When querying directly for the locale en_DE this does indeed deliver the proper results. When querying for a locale that does not yet have any data and falling back to en_DE the where operation has the consequence that no documents are found. When removing the where clause the expected data from the en_DE fallback locale is delivered.
To Reproduce
- Have a document with a field (textfield, checkbox or something that makes for an easy where selection) that has localized set to true and another field (like a text field) also with localized set to true just for content.
- Have at least two locales configured and for one of them the document has data (fields are filled out), for the other it does not.
- Specify the GraphQL query to fallback to the locale where data was entered.
- Query for the document with the locale that does not have data, also specifying that one of the documents fields needs to have a certain value with the where clause (easiest would be a checkbox boolean value like in my case).
- Even though the document in the fallback locale contains the appropriate value no documents are returned.
After further investigation: (edited the reproduction steps as well) I found that for a slug text field that I have in the document it works properly but with another title text field it does not work.
The only difference between the fields: The title is required and localized. The slug is neither. The showInOverview field is also localized and required. This might have something to do with the fact that the field I select for in the query is localized 🤔 (I would suspect that rather than the required prop)
Payload Version
2.13.0
Adapters and Plugins
db-mongodb, bundler-webpack, plugin-cloud-storage, richtext-lexical, translator-plugin