-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
Interceptors aren't chained #371
Comments
@veloware I came across the same problem and solved very similar approach as you mentioned. |
@veloware how can you access the globalOptions? |
@alon-green there is a 2nd arg you can pass to
|
@veloware thanks for the answer, but I already pass options in the useFetch, in nested hook, I need access to the option of the provider |
in the case above though, the |
But I can't access the provider, can't I take it from the context or something? |
@veloware Let me try to create a CodesandBox of this |
@alon-green here is the CodeSandbox https://codesandbox.io/s/usefetch-use-http-todo-list-app-managed-state-forked-x1ru0p?file=/src/index.js. If this code sandbox is clarifying solution to your problem or still, it is a problem. now you can modify the code sandbox to help us to understand better. hopefully we can solve it. |
Describe the bug
Interceptors aren't chained, in that global interceptors at the provider level, are overridden if an interceptor is introduced at the
useFetch()
hook levelThere does seem to be a work around, at the hook level -
However, that could easily be forgotten on a case per case basis, and is no different that just housing the 'global' interceptor code in a standard function, and just invoking that, which defeats the purpose of a global 'interceptor'
Please do this to easily reproduce the bug.
To Reproduce
Expected behavior
Both should run, probably the global first, then the more specific interceptor at the hook level second
The text was updated successfully, but these errors were encountered: