Repository navigation
Replies: 2 comments 2 replies
|
Ok, it recognizes missing dependencies in a dependent query key, so it works. I still don't understand, why it don't warn about the query client in the example I brought though... it is not a big deal though. |
|
It doesn't warn about the query client because the Just stumbled upon a very similar issue myself. When the code is written this way (arrow function): const useQueryClient = () => {
const customMutationCache = useCustomMutationCache()
const client = new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
retry: 0,
},
},
mutationCache: customMutationCache,
})
return client
}it doesn't flag the unstable client. This version (named function): function useQueryClient() {
const customMutationCache = useCustomMutationCache()
const client = new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
retry: 0,
},
},
mutationCache: customMutationCache,
})
return client
}produces the following warning:
There is one more issue, this code: import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
export function App () {
return (
<QueryClientProvider client={new QueryClient()}>
</QueryClientProvider>
);
};still doesn't produce the warning, since there is another limitation: the instance has to be assigned to a variable for the rule to work properly, like so: import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
export function App () {
const queryClient = new QueryClient();
return (
<QueryClientProvider client={queryClient}>
</QueryClientProvider>
);
}; |
Uh oh!
There was an error while loading. Please reload this page.
I've tried to get the eslint plugin to work, but...so far no success. What do I do wrong? At the moment I have the new flat config, but I also tried the legacy one with the same result.
repo details
package.jsoneslint.config.jscode which should the plugin react to
What do I do wrong? Any help much appreciated.
All reactions