Skip to content

@include / @skip not working? #616

@BorisKamp

Description

@BorisKamp

Environment



Describe the bug

I have the following query:

query Business_settings($filter: business_settings_filter, $skipUsers: Boolean = true) {
    business_settings(filter: $filter) {
        date_created
        date_updated
        dotoo_job_plan_ahead_count
        enable_dotoo_jobs
        id
        sort
        status
        business {
            id
            status
            sort
            date_created
            date_updated
            name
            slug
            about
            cover_image {
                id
                storage
                filename_disk
                filename_download
                title
            }
            logo {
                id
                storage
                filename_disk
                filename_download
                title
            }
            users @skip(if: $skipUsers) {
                id
                type
                directus_users_id {
                    id
                    first_name
                    last_name
                    email
                    status
                    avatar {
                        id
                        title
                        description
                        filename_disk
                        filename_download
                    }
                }
                businesses_id {
                    id
                }
            }
        }
        promotion_images {
            id
            directus_files_id {
                id
                storage
                filename_disk
                filename_download
                title
            }
        }
    }
}

Now when I use this like this:

const res = await GqlBusiness_settings({
      filter: { business: { slug: { _eq: slug } } },
      skipUsers: true,
    })

I get an GQL error:

{
    "errors": [
        {
            "message": "GraphQL validation error.",
            "extensions": {
                "errors": [
                    {
                        "message": "Cannot query field \"first_name\" on type \"directus_users\".",
                        "locations": [
                            {
                                "line": 39,
                                "column": 11
                            }
                        ]
                    },
                    {
                        "message": "Cannot query field \"last_name\" on type \"directus_users\".",
                        "locations": [
                            {
                                "line": 40,
                                "column": 11
                            }
                        ]
                    },
                    {
                        "message": "Cannot query field \"avatar\" on type \"directus_users\".",
                        "locations": [
                            {
                                "line": 43,
                                "column": 11
                            }
                        ]
                    }
                ],
                "code": "GRAPHQL_VALIDATION"
            }
        }
    ]
}

So the @Skip is ignored it seems!

In chrome networking tab, I see these variables for the request:

{
    "filter": {
        "business": {
            "slug": {
                "_eq": "bootcamp-soldiers"
            }
        }
    },
    "skipUsers": true
}

So that is correct!

Expected behaviour

To skip the user node

Reproduction

No response

Additional context

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions