Currently createSWRHooks is limited to use of the global swr config (state/cache) which prevents us from being able to correctly make use of <SWRConfig /> since mutations would always apply to the global state rather than context state (where we'd be reading from). getUseMatchMutate already operates correctly on the config provided by the nearest context.
This change updates TRPCProvider to use useSWRConfig().mutate, which operates on the context state (where context is available) or falls back to global state.
Currently
createSWRHooks
is limited to use of the globalswr
config (state/cache) which prevents us from being able to correctly make use of<SWRConfig />
since mutations would always apply to the global state rather than context state (where we'd be reading from).getUseMatchMutate
already operates correctly on the config provided by the nearest context.This change updates
TRPCProvider
to useuseSWRConfig().mutate
, which operates on the context state (where context is available) or falls back to global state.