TanStackT
TanStack2y ago
1 reply
sad-indigo

Migrating v4 to v5 give me couple of errors on some of the queries

Hi there i'm trying to migrated to v5 using the codemod in the docs. After running it, I get some queries where I have to manually migrate te query. But I'm having problems understanding the error and how to migrate them. For example


// v4

async function getOverzichtEigenBezwaarschriften(urlProps: IUrlProps) {
  const { data } =
    await omvUpInzageProjectfasenApi.get<IBezwaarschriftenPageableResponse>(
      getOverzichtEigenBezwaarschriftenUrlSuffix(urlProps),
    );
  return data;
}

export function useOverzichtEigenBezwaarschriften({
  projectfaseUuid,
  groepUuid,
  page,
  keepPreviousData = false,
}: IRequest) {
  const options = { ...defaultOptions, ...page } as IPagingOptions;

return useQuery<IBezwaarschriftenPageableResponse>({
    queryKey: [
      'overzicht-eigen-bezwaarschriften',
      { projectfaseUuid, groepUuid, page: options.pageParam },
    ],

    queryFn: () => {
      return getOverzichtEigenBezwaarschriften({
        projectfaseUuid,
        groepUuid,
        options,
      });
    },

    keepPreviousData,
    enabled: !!projectfaseUuid,
    staleTime: 0,
  });
}
ts


and in version5

export function useOverzichtEigenBezwaarschriften({
  projectfaseUuid,
  groepUuid,
  page,
  keepPreviousData = false,
}: IRequest) {
  const options = { ...defaultOptions, ...page } as IPagingOptions;

  return useQuery<IBezwaarschriftenPageableResponse>({
    queryKey: [
      'overzicht-eigen-bezwaarschriften',
      { projectfaseUuid, groepUuid, page: options.pageParam },
    ],

    queryFn: () => {
      return getOverzichtEigenBezwaarschriften({
        projectfaseUuid,
        groepUuid,
        options,
      });
    },

    keepPreviousData,
    enabled: !!projectfaseUuid,
    staleTime: 0,
  });
}


but Im getting an eslint error message on the
queryKey


The following dependencies are missing in your queryKey: optionseslint@tanstack/query/exhaustive-deps
Was this page helpful?