Skip to content

Commit

Permalink
added deduping interval for swr hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-tey committed Sep 24, 2022
1 parent 9484bd0 commit 17833ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/swr/use-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export default function useProject() {

const { data: project, error } = useSWR<ProjectProps>(
slug && `/api/projects/${slug}`,
fetcher
fetcher,
{
dedupingInterval: 30000,
}
);

return {
Expand Down
5 changes: 4 additions & 1 deletion lib/swr/use-usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ export default function useUsage(project: ProjectProps) {
router.isReady &&
project &&
`/api/projects/${slug}/domains/${project.domain}/usage`,
fetcher
fetcher,
{
dedupingInterval: 10000,
}
);

const exceededUsage = useMemo(() => {
Expand Down

0 comments on commit 17833ae

Please sign in to comment.