Fallback locales should be considered for filtering and sorting (GraphQL)

Let’s assume this dataset:

{
   "pages": [
      {
         "title": {
            "en": "Lake Geneva",
            "de": "Genfersee"
         }
      },
      {
         "title": {
            "en": "Islisberg",
            "de": ""
         }
      }
   ]
}

And now let’s make these queries:

query {
   a: page(filter: {title: {eq: "Islisberg"}}, locale: de, fallbackLocales: [en]) {
      title
   }
   b: allPages(orderBy: title_ASC, locale: de, fallbackLocales: [en]) {
      title
   }
}

which results in:

{
   "data": {
      "a": null,
      "b": [
         {
            "title": "Islisberg"
         }
         {
            "title": "Genfersee"
         },
      ]
   }
}

while the expected result would be:

{
   "data": {
      "a": [
         {
            "title": "Islisberg"
         }
      ],
      "b": [
         {
            "title": "Genfersee"
         }
         {
            "title": "Islisberg"
         },
      ]
   }
}

To me, this is a bug. The fallbackLocales must be used for the eq filter as well as for the orderBy clause.

@tools-dt_myswitzerland This is something we are aware of, it is something we want to address in the future and is on our current roadmap, but for now the current default behaviour is that the fallback locales are only used to fallback when returning results, not when filtering

Thank you for the feedback!

Hi, I’m running into the same issue. Is a solution or workaround available?

Hello @petercoolen and welcome to the community!

Not at the moment, unfortunately :frowning:

1 Like

Hi! We are experiencing the same issue and would appreciate any insights or potential solutions. It would be great to know if there are any updates on this matter.

Hi @e.v.hooff,

Sorry, I’ll check on this again for you to see if there’s been any improvements on our end.

In the meantime, a potential workaround might be to over-fetch that data without any filtering from us, and then filter it on the clientside (or in middleware, if your framework allows it). That’s definitely not as clean or easy, though :frowning:

I’ll let you know what the devs say as soon as I hear back. Sorry about that!

Bad news: I’m sorry, this is still not a feature planned for implementation right now :frowning: I know it’s annoying and frustrating, and I’m sorry that the clientside/middleware workaround is the only way to do it right now.

If you have a specific model you want to do this with and need help with some sample code that can do it clientside, please let me know and I can make you an example.