From 44318bbe405d3ba7e6d034deaeb8aa080485e4d2 Mon Sep 17 00:00:00 2001 From: Dan Ko Date: Thu, 14 Nov 2024 17:08:07 -0500 Subject: [PATCH] update query key to use cache tag instead of hardcoded string --- src/app/(main)/layout.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/(main)/layout.tsx b/src/app/(main)/layout.tsx index 6661c3f9..ab1e2c1b 100644 --- a/src/app/(main)/layout.tsx +++ b/src/app/(main)/layout.tsx @@ -15,6 +15,7 @@ import { getUserState } from "@/store/features/user/userSlice"; import { TYPES } from "@/di/types"; import { resolve } from "@/di/resolver"; import Spinner from "@/components/Spinner"; +import { CacheTag } from "@/utils/cacheTag"; interface LayoutProps { children: React.ReactNode; @@ -25,7 +26,7 @@ export default function Layout({ children }: LayoutProps) { const router = useRouter(); const { isPending, isError, data } = useQuery({ - queryKey: ["user"], + queryKey: [CacheTag.me], queryFn: getUserQuery, staleTime: 1000 * 60 * 30, // This sets it to 30 minutes, which is how long the access token lasts });