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

Properly clone context for batched queries #858

Closed
drakhart opened this issue Aug 30, 2022 · 1 comment · Fixed by #859
Closed

Properly clone context for batched queries #858

drakhart opened this issue Aug 30, 2022 · 1 comment · Fixed by #859

Comments

@drakhart
Copy link
Contributor

#849 didn't finally fix #842.

For some reason I'm still investigating, Object.create(request) is not creating a truly independent clone of the request object, so the Mercurius context is still getting shared among all the batched queries.

This needs further investigation to find a proper fix, and once fixed hook spies (i.e. onResolution) should be added to double check the context values at different points of the request (since the resolver spy has proven to be incapable of catching the error).

@drakhart
Copy link
Contributor Author

drakhart commented Aug 31, 2022

My fault: when I moved from cloning just the context to cloning the full request I didn't take into account that Object.create(request) would not clone the properties inside the context, just reference them (as they sit at a 2nd level inside the request).

I'm creating a new PR that will fix this.

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

Successfully merging a pull request may close this issue.

1 participant