refetch subqueries after refetchInterval on parent has completed

Quick question regarding refetchInterval

I have this this query set to refetch every 10 seconds if a condition isnt met

  const {
    data: job,
    isFetched: isFetchedJob,
    isFetching: isFetchingJob,
    isRefetching: isRefetchingJob,
    isPlaceholderData: isPlaceholderJob,
    refetch: refetchJob,
  } = useQuery({
    ...getJobQueryOpts({ jobId: activeContext.jobId! }),
    refetchInterval: (query) => {
      const data = query.state.data;

      if (
        data?.nitems !== data?.nprocessed &&
        query.state.dataUpdateCount < 10
      ) {
        console.log({
          updateCount: query.state.dataUpdateCount,
          data: `${data?.nprocessed} / ${data?.nitems}`,
        });
        return 1000 * 10; // Refetch every 10 seconds until update count is 10.
      } else {

        return false;
      }
    },
  });


This query is dependant on the above, and I need it to be refetched once the refetch has been fulfilled

  const { data: emurateJobItemsData, isFetching: isFetchingJobItems } =
    useQuery({
      ...emurateJobsItemsQueryOpts({
        jobId: activeContext.jobId!,
        continuationToken: undefined,
      }),
    });
Was this page helpful?