Fix dataloaders not loading in js plugins (#3014)

* Include dataloaders in js plugin gql calls
* Handle gql errors correctly in js plugins
This commit is contained in:
WithoutPants
2022-10-18 11:09:54 +11:00
committed by GitHub
parent bd44571a91
commit 4c286d7ab5
2 changed files with 6 additions and 3 deletions

View File

@@ -122,7 +122,9 @@ func Start() error {
// register GQL handler with plugin cache
// chain the visited plugin handler
manager.GetInstance().PluginCache.RegisterGQLHandler(visitedPluginHandler(http.HandlerFunc(gqlHandlerFunc)))
// also requires the dataloader middleware
gqlHandler := visitedPluginHandler(dataloaders.Middleware(http.HandlerFunc(gqlHandlerFunc)))
manager.GetInstance().PluginCache.RegisterGQLHandler(gqlHandler)
r.HandleFunc("/graphql", gqlHandlerFunc)
r.HandleFunc("/playground", gqlPlayground.Handler("GraphQL playground", "/graphql"))