graphql-middleware: Bug: "applyMiddleware" updates the schema rather than replacing
The cause is where addResolveFunctionsToSchema
from graphql-tools
is used which is actually updating the schema rather than replacing it, causing continues re-wrap of middleware on resolver when it is called and this in turn makes queries against the schema slower and slower.
showcase: https://github.com/gdeividas/graphql-middleware for demonstration run:
yarn
npx tsc && npx ava dist/test/showcase.test.js
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 4
- Comments: 16 (5 by maintainers)
Commits related to this issue
- Refactor notification spec Wow this took me the entire day: If you run `createServer` multiple times, more and more middlewares get added to the schema. That's why the test would create 2^n notificat... — committed to Human-Connection/Human-Connection by roschaefer 5 years ago
- Refactor notification spec Wow this took me the entire day: If you run `createServer` multiple times, more and more middlewares get added to the schema. That's why the test would create 2^n notificat... — committed to Human-Connection/Human-Connection by roschaefer 5 years ago
- Merge pull request #1 from BigsonLvrocha/feat/update-library - Adds support for graphql 15 (Fixes https://github.com/prisma-labs/graphql-middleware/issues/254) - Adds immutability (Fixes https://git... — committed to BigsonLvrocha/graphql-middleware by BigsonLvrocha 4 years ago
- fix(middleware): fix schema object mutation BREAKING CHANGE Fixes #63, #267 — committed to BigsonLvrocha/graphql-middleware by deleted user 4 years ago
- fix(middleware): fix schema object mutation BREAKING CHANGE Fixes #63, #267 — committed to BigsonLvrocha/graphql-middleware by deleted user 4 years ago
This probably should not be closed by the bot as its still relevant.
I’ve just noticed this issue could be fixed by updating graphql-tools to the newest version, but it drops support for node 10.17.0 or lower.