Skip to content

Commit fa0f194

Browse files
committed
add default cache/stale values
1 parent 23999c9 commit fa0f194

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/features/cards/components/producthuntCard/ProducthuntCard.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,16 @@ import { ProductHuntPlaceholder } from 'src/components/placeholders'
66
import ArticleItem from './ArticleItem'
77

88
export function ProductHuntCard({ meta, withAds }: CardPropsType) {
9-
const { data: products = [], isLoading, error } = useGeProductHuntProducts()
9+
const {
10+
data: products = [],
11+
isLoading,
12+
error,
13+
} = useGeProductHuntProducts({
14+
config: {
15+
staleTime: 900000, //15 minutes
16+
cacheTime: 3600000, // 1 Day
17+
},
18+
})
1019

1120
const renderItem = (item: Article, index: number) => (
1221
<ArticleItem item={item} key={`ph-${index}`} index={index} analyticsTag={meta.analyticsTag} />

src/lib/react-query.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ const queryConfig: DefaultOptions = {
77
useErrorBoundary: false,
88
refetchOnWindowFocus: false,
99
retry: false,
10+
staleTime: 3600000, //1 Hour
11+
cacheTime: 3600000, // 1 Day
1012
},
1113
};
1214

0 commit comments

Comments
 (0)