Skip to content

Commit

Permalink
♻️ Set stale time to infinity for boards
Browse files Browse the repository at this point in the history
  • Loading branch information
injoonH committed May 24, 2024
1 parent f7606bc commit 6f0b8ea
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib/queries/board.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const useBoards = () =>
useQuery({
queryKey: ["boards"],
queryFn: getBoards,
staleTime: Infinity,
});

export const useBoardBySlug = (slug: string) => {
Expand All @@ -16,13 +17,15 @@ export const useBoardBySlug = (slug: string) => {
queryFn: () => getBoardBySlug(slug),
initialData: () =>
queryClient.getQueryData<Board[]>(["boards"])?.find((board) => board.slug === slug),
staleTime: Infinity,
});
};

export const useBoardGroups = () =>
useQuery({
queryKey: ["boardGroups"],
queryFn: getBoardGroups,
staleTime: Infinity,
});

export const useBoardGroupBySlug = (slug: string) => {
Expand All @@ -34,5 +37,6 @@ export const useBoardGroupBySlug = (slug: string) => {
queryClient
.getQueryData<BoardGroup[]>(["boardGroups"])
?.find((boardGroup) => boardGroup.slug === slug),
staleTime: Infinity,
});
};

0 comments on commit 6f0b8ea

Please sign in to comment.