supabase-cache-helpers icon indicating copy to clipboard operation
supabase-cache-helpers copied to clipboard

Tanstack skipToken is not supported in queries

Open jameswilliams1 opened this issue 8 months ago • 0 comments

Describe the bug Tanstack query exports a skipToken symbol which can be used to prevent a query running while waiting for a value to be defined (e.g. from a dependent query) - similar to using enabled but more type safe. This does not work with supabase-cache-helpers and gives a typescript error.

To Reproduce

import { useQuery } from '@supabase-cache-helpers/postgrest-react-query';
import { skipToken } from '@tanstack/react-query';

const supabase = supabaseBrowserClient();
const accountId: string | undefined = getAccountId()
const { data } = useQuery(
    accountId ? myDependentQuery(supabase, accountId) : skipToken,
  );
// No overload matches this call...

Expected behavior Using skipToken in a query should be possible.

Additional context Add any other context about the problem here.

jameswilliams1 avatar Jun 23 '24 09:06 jameswilliams1