From 224b9ff80ac85e132adb4f25944008a9e5fe901a Mon Sep 17 00:00:00 2001 From: Andrew Chou Date: Thu, 12 Dec 2024 12:26:57 -0500 Subject: [PATCH] adjust query options for useSingleProject() --- src/hooks/projects.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/hooks/projects.ts b/src/hooks/projects.ts index 567f634..c66dff9 100644 --- a/src/hooks/projects.ts +++ b/src/hooks/projects.ts @@ -66,12 +66,18 @@ export function useProjectSettings({ projectId }: { projectId: string }) { export function useSingleProject({ projectId }: { projectId: string }) { const clientApi = useClientApi() - const { data, error, isRefetching } = useSuspenseQuery( - projectByIdQueryOptions({ + const { data, error, isRefetching } = useSuspenseQuery({ + ...projectByIdQueryOptions({ clientApi, projectId, }), - ) + // Keep project instances around indefinitely - shouldn't be a memory + // problem because these are only lightweight proxy objects, and project + // references are kept indefinitely on the backend anyway once they are + // accessed + staleTime: Infinity, + gcTime: Infinity, + }) return { data, error, isRefetching } }