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

Federation with dataloader grouping #3224

Open
amtineo opened this issue Aug 15, 2024 · 0 comments
Open

Federation with dataloader grouping #3224

amtineo opened this issue Aug 15, 2024 · 0 comments

Comments

@amtineo
Copy link

amtineo commented Aug 15, 2024

What happened?

I have multiple graphs that are federated with an Apollo Router. For example, I have a sample query of:

graph1field(id: "some-uuid") {
	id
        graph2field {
             id
             name
             graph3field {
                   id
                   name
             }
        }
}

The results of graph3field are not grouped to the proper graph2field. Let's say there are many graph3fields that belong to the last graph2field result, the results are not grouped to where they should be. Sample response:

{
  "data": {
      "graph1field": {
           graph2field {
                id
                name
                graph3field: []
           },
           graph2field {
                id
                name
                graph3field: [
                    id
                    name
                ]
           },
           graph2field {
                id
                name
                graph3field: [
                    id
                    name
                ]
           }
      }
   }
}

Most of the time the graph3field are mixed into the incorrect graph2field.

What did you expect?

I expect the correct grouping to happen. When I remove the dataloder referenced in your examples: dataloadgen, everything is in the correct group. However, the n+1 problem comes back.

I expect the following response always:

{
  "data": {
      "graph1field": {
           graph2field {
                id
                name
                graph3field: []
           },
           graph2field {
                id
                name
                graph3field: []
           },
           graph2field {
                id
                name
                graph3field: [
                   {
                      id
                      name
                   },
                   {
                      id
                      name
                   }
                ]
           }
      }
   }
}

Minimal graphql.schema and models to reproduce

Unfortunately, I can't share the real schema.

versions

  • go run github.com/99designs/gqlgen version?
    v0.17.49
  • go version?
    go version go1.22.0 windows/amd64
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

1 participant