diff --git a/src/App.jsx b/src/App.jsx index a573d8a..1da1fc7 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -9,6 +9,7 @@ const queryClient = new QueryClient({ defaultOptions: { queries: { suspense: true, + refetchOnWindowFocus: false, }, }, }); diff --git a/src/hooks/network/brand.js b/src/hooks/network/brand.js index 25fea1a..e6d0fce 100644 --- a/src/hooks/network/brand.js +++ b/src/hooks/network/brand.js @@ -8,7 +8,7 @@ const getBrands = async () => { export const useBrands = () => { const data = useQuery('brands', () => getBrands(), { - suspense: true, + staleTime: 1000 * 60 * 60 * 24, }); return data; @@ -21,7 +21,7 @@ const getBrand = async (id) => { export const useBrand = (id) => { const data = useQuery(['products', id], () => getBrand(id), { - suspense: true, + staleTime: 1000 * 60 * 60 * 24, }); return data; @@ -33,9 +33,7 @@ const getBrandProduct = async (id) => { }; export const useBrandProduct = (id) => { - const data = useQuery(['brandproduct', id], () => getBrandProduct(id), { - suspense: true, - }); + const data = useQuery(['brandproduct', id], () => getBrandProduct(id)); return data; }; diff --git a/src/hooks/network/graph.js b/src/hooks/network/graph.js index a708f99..2d95ad7 100644 --- a/src/hooks/network/graph.js +++ b/src/hooks/network/graph.js @@ -8,7 +8,7 @@ const getGraph = async (id) => { export const useGraph = (id) => { const data = useQuery(['post', id], () => getGraph(id), { - suspense: true, + staleTime: 1000 * 60 * 60 * 24, }); return data; diff --git a/src/hooks/network/post.js b/src/hooks/network/post.js index b9d3c68..8db1d43 100644 --- a/src/hooks/network/post.js +++ b/src/hooks/network/post.js @@ -11,9 +11,7 @@ const getPosts = async ({ my, page }) => { }; export const usePosts = ({ my, page }) => { - const data = useQuery(['post', my, page], () => getPosts({ my, page }), { - suspense: true, - }); + const data = useQuery(['post', my, page], () => getPosts({ my, page })); return data; }; @@ -24,9 +22,7 @@ const getPost = async (id) => { }; export const usePost = (id) => { - const data = useQuery(['post', id], () => getPost(id), { - suspense: true, - }); + const data = useQuery(['post', id], () => getPost(id)); return data; }; diff --git a/src/hooks/network/product.js b/src/hooks/network/product.js index 55bca02..38c33f4 100644 --- a/src/hooks/network/product.js +++ b/src/hooks/network/product.js @@ -8,7 +8,7 @@ const getProducts = async () => { export const useProducts = () => { const data = useQuery('products', () => getProducts(), { - suspense: true, + staleTime: 1000 * 60 * 60 * 24, }); return data; @@ -21,7 +21,7 @@ const getProduct = async (id) => { export const useProduct = (id) => { const data = useQuery(['product', id], () => getProduct(id), { - suspense: true, + staleTime: 1000 * 60 * 60 * 24, }); return data; @@ -37,9 +37,6 @@ export const useProductPost = ({ id, page }) => { const data = useQuery( ['productpost', id], () => getProductPost({ id, page }), - { - suspense: true, - } ); return data;