Skip to content

Commit

Permalink
perf: don't refetch the "studio home data" too often
Browse files Browse the repository at this point in the history
  • Loading branch information
bradenmacdonald committed May 7, 2024
1 parent d85522b commit 29daee5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/generic/data/apiHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ export const useContentTagsCount = (contentId) => {
export const useStudioHomeData = () => useQuery({
queryKey: ['studioHomeData'],
queryFn: getStudioHomeData,
// Currently this is only used for 'useTaggingFeaturesEnabled' so we don't need to refetch it so often.
cacheTime: 10 * 60_000, // Even if we're not actively using this, keep it in memory up to ten minutes
staleTime: 10 * 60_000, // If cache is up to ten minutes old, no need to re-fetch
refetchInterval: 10 * 60_000,
refetchOnWindowFocus: false, // This doesn't need to be refreshed when the user switches back to this tab.
refetchOnMount: false,
});

/**
Expand Down

0 comments on commit 29daee5

Please sign in to comment.