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

API: Fix for function based context to run on each request #770

Merged
merged 2 commits into from
Jun 30, 2020

Conversation

nexneo
Copy link
Contributor

@nexneo nexneo commented Jun 30, 2020

As per discussion in this thread, https://community.redwoodjs.com/t/context-function-passed-to-creategraphqlhandler-runs-only-once-on-first-request/801

context function passed to createGraphQLHandler was running only once, after some debugging it seems function was overwritten with the data return from that same context function.

With this change you can pass context as function and will run on every request, which is super useful if you are implementing custom authentication for legacy reasons.

Thanks!

As per discussion in this thread, https://community.redwoodjs.com/t/context-function-passed-to-creategraphqlhandler-runs-only-once-on-first-request/801

context function passed to createGraphQLHandler was running only once, after some debugging it seems function was overwritten with the data return from that custom context function
@peterp
Copy link
Contributor

peterp commented Jun 30, 2020

@nexneo Thanks for this, amazing!

@peterp peterp added this to the next release milestone Jun 30, 2020
@nexneo
Copy link
Contributor Author

nexneo commented Jun 30, 2020

Thanks @peterp contributing to Redwood was super simple with help of this Guide

@peterp peterp merged commit 80ec69d into redwoodjs:main Jun 30, 2020
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 this pull request may close these issues.

None yet

2 participants