Skip to content

DocumentNode type of args.query in simpleQuery/simpleMutation call lost fragment body #78

@mayoujin

Description

@mayoujin

Hi!
Earlier, it was advised to support argument query of type DocumentNode (GraphQL AST) in simpleQuery and simpleMutation methods #70.

And it was added, thx! But it has some problems concerning usage of fragments in a AST queries. Imported fragment's body is lost in graphql server request payload field query of POST body.
For example, native file with gql

#import "Fragment.gql"

query Entity {
    ...Fragment
}

Now, Fragment.gql content would not be appended to above body in server graphql request. It should look in a such a way as

query Entity {
    ...Fragment
}

Fragment on Entity {
   field
}

Method graphQlDocumentToString of (@vuex-orm/plugin-graphql/dist/lib/support/utils.js) losts fragments body that should be appended to base query body.

And also, when it was suggested to support prepared parsed DocumentNode type of query it was aimed to avoid unnecessary conversion of query string to DocumentNode object before the native apollo client apollo.query method's call. That accepts query in required DocumentNode type.
I believe you take notice that and some time or later improve your code).
Good luck!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions