Skip to content

GraphQL filter not working as intended #10290

@JelmerOT

Description

@JelmerOT

Bug description

I made a query to fetch articles based on the ID of the taxonomy.

query MyQuery {
  entries(
    collection: "articles"
    site: "nl_nl"
    filter: {
      article_categories: {
        id: { is: "article_categories::slapen" }
      }
    }
  ) {
    from
    to
    data {
      id
      url
      date
      title
      status
      permalink
      ... on Entry_Articles_Article {
        id
        article_categories {
          id
          title
          url
          slug
          uri
        }
      }
    }
  }
}

This is what it returns:

{
  "data": {
    "entries": {
      "from": 1,
      "to": 2,
      "data": [
        {
          "id": "25c76288-e56f-4a08-9265-588012db56b3",
          "url": "/blog/het-slopende-effect-van-insomnia-hoe-het-uw-dagelijks-leven-beinvloedt",
          "date": "2024-06-11 00:00:00",
          "title": "Het slopende effect van insomnia: hoe het uw dagelijks leven beïnvloedt",
          "status": "published",
          "permalink": "http://localhost:3000/blog/het-slopende-effect-van-insomnia-hoe-het-uw-dagelijks-leven-beinvloedt",
          "article_categories": [
            {
              "id": "article_categories::slapen",
              "title": "Slapen",
              "url": "/blog/article-categories/slapen",
              "slug": "slapen",
              "uri": "/blog/article-categories/slapen"
            },
            {
              "id": "article_categories::droomsap",
              "title": "Droomsap",
              "url": "/blog/article-categories/droomsap",
              "slug": "droomsap",
              "uri": "/blog/article-categories/droomsap"
            },
            {
              "id": "article_categories::onderzoek",
              "title": "Onderzoek",
              "url": "/blog/article-categories/onderzoek",
              "slug": "onderzoek",
              "uri": "/blog/article-categories/onderzoek"
            }
          ]
        },
        {
          "id": "35b520ab-e84e-47d5-99e5-c957a23d20b3",
          "url": "/blog/het-slopende-effect-van-insomnia",
          "date": "2024-06-11 00:00:00",
          "title": "Het slopende effect van insomnia",
          "status": "published",
          "permalink": "http://localhost:3000/blog/het-slopende-effect-van-insomnia",
          "article_categories": [
            {
              "id": "article_categories::droomsap",
              "title": "Droomsap",
              "url": "/blog/article-categories/droomsap",
              "slug": "droomsap",
              "uri": "/blog/article-categories/droomsap"
            },
            {
              "id": "article_categories::onderzoek",
              "title": "Onderzoek",
              "url": "/blog/article-categories/onderzoek",
              "slug": "onderzoek",
              "uri": "/blog/article-categories/onderzoek"
            }
          ]
        }
      ]
    }
  }
}

You can see that the second article does not contain a taxonomy with an id of article_categories::slapen.

How to reproduce

Create a new statamic project. Create an articles collection and article_categories taxonomy. Connect these two.

Then query the articles with a filter.

Logs

No response

Environment

Environment
Application Name: Statamic
Laravel Version: 11.10.0
PHP Version: 8.3.6
Composer Version: 2.6.5
Environment: local
Debug Mode: ENABLED
URL: api.dromenwinkel.com.test
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Sentry
Enabled: MISSING DSN
Environment: local
Laravel SDK Version: 4.6.0
PHP SDK Version: 4.8.0
Release: NOT SET
Sample Rate Errors: 100%
Sample Rate Performance Monitoring: NOT SET
Sample Rate Profiling: NOT SET
Send Default PII: DISABLED

Statamic
Addons: 7
Sites: 3 (Nederlands, English, Canada)
Stache Watcher: Disabled
Static Caching: Disabled
Version: 5.7.2 PRO

Statamic Addons
aryehraber/statamic-logbook: 3.3.0
orangetalent/statamic-graphql-breadcrumbs: dev-main
orangetalent/statamic-graphql-lang: dev-main
ryanmitchell/statamic-translation-manager: 2.0.0
studio1902/statamic-peak-seo: 8.14.0
studio1902/statamic-peak-tools: 6.1.0
webographen/statamic-admin-log: 1.1.0

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions