Open
Description
swr-openapi version
5.1.4
Description
Currently the mutate provided by useMutate does not support a filter function argument the same way that swr does. The filter function allows for path matching without filters. For example if you want to invalid /teams
with any query params, with swr you can do the following:
const mutate = useMutate()
mutate(
key => typeof key === 'string' && key.startsWith('/teams?'),
undefined,
{ revalidate: true }
)
I realize that this will be a bit different with SWR since storage keys are slightly different, but would still be nice to have our own ability to pass this function
Reproduction
Attempt to pass a function to mutate
- notice that it does not accept a function the same way that SWR does
Expected result
Calling mutate
with custom key settings based on function as you can do with SWR
Extra
- I’m willing to open a PR (see CONTRIBUTING.md)