Closed
Description
Possibly related to #135
Describe the bug
When deleting/overwriting a global option in one instance of useFetch, the global options are then permanently modified across all instances.
Following the example in the README:
// let's say for this request, you don't want the `Accept` header at all
const { loading, error, data: todos } = useFetch(globalOptions => {
delete globalOptions.headers.Accept
return {
data: [],
...globalOptions
}
}, []) // onMount
This line:
delete globalOptions.headers.Accept
Will delete the Accept header for all useFetch instances across an app.
https://codesandbox.io/embed/goofy-bird-yhon5?fontsize=14&hidenavigation=1&theme=dark
To Reproduce
Steps to reproduce the behavior:
- Go to Login page
- Click on "Login" button
- Open the console - the Todo useFetch options do not have the interceptors.request property that is defined in the global options passed to the Provider.
Expected behavior
I would expect that modifying the global options in an instance of useFetch would create a local copy and would not affect the global options in any other instances.
Metadata
Metadata
Assignees
Labels
No labels