In my own usage of @tanstack/react-query I use a QueryCache() for the global configuration of the query client alongside some custom defined meta data fields on queries and mutations.
In one scenario I pass a field that indicates if a 401 error should redirect user to login or not based on the meta: {...} field of the useQuery or useMutation.
The problem I faced was once the <AuthLoader /> initiated the useUser hook the meta would be passed as undefined leading to unexpected results like unwanted redirects which was really hard to debug.
I suggest adding the optional options prop with the same type as the useUser options.
@alan2207
In my own usage of
@tanstack/react-queryI use aQueryCache()for the global configuration of the query client alongside some custom defined meta data fields on queries and mutations.In one scenario I pass a field that indicates if a
401error should redirect user to login or not based on themeta: {...}field of theuseQueryoruseMutation.The problem I faced was once the
<AuthLoader />initiated theuseUserhook themetawould be passed asundefinedleading to unexpected results like unwanted redirects which was really hard to debug.I suggest adding the optional
optionsprop with the same type as theuseUseroptions.@alan2207