Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: add unwanted combine of all queries and mutations into a single file to the desired query. #619

Closed
resfandiari opened this issue Dec 17, 2024 · 1 comment

Comments

@resfandiari
Copy link

When I run the desired query, it sends a request to the server that combines all queries and mutations found in a single .graphql file.
for example consider this file :

# import '../fragments/paginator_fragment.graphql'

query Spaces(
    $first: Int = 100
    $page: Int
    $iSpaceCalendars: Boolean = true
    $iSpaceLocations: Boolean = true
) {
    me {
        spaces(first: $first, page: $page) {
            paginatorInfo {
                ...PaginatorInfoFragment
            }
            data {
                ...SpaceFragment
            }
        }
    }
}

mutation AttachUserSpace(
    $user_id: ID!
    $space_id: ID!
    $iSpaceCalendars: Boolean = false
    $iSpaceLocations: Boolean = false
) {
    attachUserSpace(user_id: $user_id, space_id: $space_id) {
        ...SpaceFragment
    }
}

mutation DetachUserSpace(
    $user_id: ID!
    $space_id: ID!
    $iSpaceCalendars: Boolean = false
    $iSpaceLocations: Boolean = false
) {
    detachUserSpace(user_id: $user_id, space_id: $space_id) {
        ...SpaceFragment
    }
}


fragment SpaceFragment on Space {
    id
    calendars @include(if: $iSpaceCalendars) {
        id
    }
    locations(first: 1000) @include(if: $iSpaceLocations) {
        paginatorInfo {
            ...PaginatorInfoFragment
        }
        data {
            ...LocationFragment
        }
    }
}

fragment LocationFragment on Location {
    id
}

When I try to run the Spaces query, it runs a query that includes Spaces+AttachUserSpace+DetachUserSpace.
What caused this to happen?

• Dart version 3.5.4
• Flutter version 3.24.5 on channel stable

 ferry: ^0.16.0-dev.4
 ferry_flutter: ^0.9.1-dev.1
 gql_http_link: ^1.1.0
 gql_exec: ^1.0.0+1
 gql_exec: ^1.0.0+1
 build_runner: ^2.4.13
 ferry_generator: ^0.12.0
@knaeckeKami
Copy link
Collaborator

Duplicate of #605

@knaeckeKami knaeckeKami marked this as a duplicate of #605 Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants