From e615ad0282fa02ce7e81a847b43dd3146f69b769 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 14 Mar 2021 06:40:09 +0300 Subject: fix: match keys everywhere --- src/hooks/useAPIClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/hooks') diff --git a/src/hooks/useAPIClient.ts b/src/hooks/useAPIClient.ts index b36cfec..f2f2782 100644 --- a/src/hooks/useAPIClient.ts +++ b/src/hooks/useAPIClient.ts @@ -23,7 +23,7 @@ export const useProducts = (options = {}): Response => { export const useProduct = (_id: string): Response => { const { data: preloadedProducts } = useProducts({ revalidateOnMount: false }); - const result = useSWR(`/products/${_id}`, fetcher); + const result = useSWR(_id && `/products/${_id}`, fetcher); if (!result.data && result.isValidating) { // If we are waiting for the first result, check if we can maybe // get the data from already cached list for the time-being -- cgit v1.2.3