Next.js Discord

Discord Forum

Cache problem

Unanswered
African Slender-snouted Crocodil… posted this in #help-forum
Open in Discord
Avatar
African Slender-snouted CrocodileOP
so i have this issue guys when i click on goals from my dashboard it takes me to page with empty goals but when i refersh the page then i can see the data been fetched
Image
Image
Image

3 Replies

Avatar
African Slender-snouted CrocodileOP
i am think maybe if this is the issue but i am not entirely sure
 "use client";

import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { useState } from "react";

export const ReactQueryClientProvider = ({
  children,
}: {
  children: React.ReactNode;
}) => {
  const [queryClient] = useState(
    () =>
      new QueryClient({
        defaultOptions: {
          queries: {
            // With SSR, we usually want to set some default staleTime
            // above 0 to avoid refetching immediately on the client
            staleTime: 60 * 1000,
          },
        },
      })
  );
  return (
    <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
  );
};
oppies nvm i fixed it
the query key for both my dash and goals page are the same so that's why