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

@defer directive cancel load #3008

Open
fawzii0x3 opened this issue Apr 15, 2024 · 0 comments
Open

@defer directive cancel load #3008

fawzii0x3 opened this issue Apr 15, 2024 · 0 comments

Comments

@fawzii0x3
Copy link

graphql setup code :

	graphConfig := graph.Config{Resolvers: c.resolver}
	graphConfig.Directives.HasRole = directives.HasRoleProvider(c.resolver)
	graphConfig.Directives.Validate = directives.ValidateProvider()
	gqlHandler := handler.New(graph.NewExecutableSchema(graphConfig))
	gqlHandler.AddTransport(transport.Websocket{
		InitFunc: func(ctx context.Context, initPayload transport.InitPayload) (context.Context, *transport.InitPayload, error) {
			return ctx, &initPayload, nil
		},
		KeepAlivePingInterval: 10 * time.Second,
		Upgrader: websocket.Upgrader{
			CheckOrigin: func(r *http.Request) bool {
				return true
			},
		},
	})
	gqlHandler.AddTransport(transport.SSE{})
	gqlHandler.AddTransport(transport.Options{})
	gqlHandler.AddTransport(transport.GET{})
	gqlHandler.AddTransport(transport.POST{})
	gqlHandler.AddTransport(transport.MultipartForm{})
	gqlHandler.Use(extension.Introspection{})

What happened?

query :

 Me {
    ...user @defer
  }
}


fragment user on Profile{
  ID
  UserRole
 Address {
  ...@defer{
    ID
  }
}
}

result:

{
  "data": {
    "Me": {
      "ID": "74cad214-cf15-4bb1-8a8a-b98186dd32cc",
      "UserRole": "parent",
      "Address": null
    }
  },
  "hasNext": true
}

What did you expect?

continue to load the address

Minimal graphql.schema and models to reproduce

type Profile {
    ID: ID!
    UserRole: UserRole
    Address: Address
}
type Address{
    ID : ID!
}

versions

  • go run github.com/99designs/gqlgen version 0.17.45
  • go version 1.22.0
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