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

Why does applyMiddleware mutate the schema passed into it? #267

Closed
lastmjs opened this issue Aug 5, 2020 · 2 comments
Closed

Why does applyMiddleware mutate the schema passed into it? #267

lastmjs opened this issue Aug 5, 2020 · 2 comments

Comments

@lastmjs
Copy link

lastmjs commented Aug 5, 2020

Hi there,

Thanks for all of the hard work on this library.

I just battled a bug for a while, it was very confusing trying to figure out what was happening. The answer it seems is that applyMiddleware is actually mutating the schema passed into it. I was under the assumption that the API was immutable, considering the modified schema is returned from applyMiddleware. This assumption led me to believe that I could reuse the schema passed in without the middleware applied. This caused big problems.

It would be nice if applyMiddleware could be immutable as the API implies. Is there a reason for it to not be immutable?

If mutations are necessary for some reason, could this be documented somewhere?

Thanks!

@BigsonLvrocha
Copy link
Contributor

BigsonLvrocha commented Dec 4, 2020

duplicate of #63

BigsonLvrocha pushed a commit to BigsonLvrocha/graphql-middleware that referenced this issue Dec 7, 2020
BigsonLvrocha pushed a commit to BigsonLvrocha/graphql-middleware that referenced this issue Dec 10, 2020
@maticzav
Copy link
Owner

This has been resolved now.

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

3 participants