From a460ca1882d158f1ceee9a965245acceee1e43d0 Mon Sep 17 00:00:00 2001 From: tomek-i Date: Thu, 29 Aug 2024 20:22:22 +1000 Subject: [PATCH] refactor: Remove delay function in usePosts hook The delay function in the usePosts hook has been removed as it is no longer necessary. This change improves code simplicity and removes unnecessary waiting time. --- src/components/hooks/usePosts.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/components/hooks/usePosts.ts b/src/components/hooks/usePosts.ts index 126c2d1..0bdb90e 100644 --- a/src/components/hooks/usePosts.ts +++ b/src/components/hooks/usePosts.ts @@ -31,8 +31,6 @@ interface NodeRequire { ) => __WebpackModuleApi.RequireContext; } -const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); - export const usePosts = () => { const [posts, setPosts] = useState[]>(); const [tags, setTags] = useState(); @@ -88,7 +86,6 @@ export const usePosts = () => { // Wait for all promises to resolve let results = await Promise.all(promises); - await delay(3000); const unsortedTags = countTags(results); setTags(unsortedTags?.sort((a, b) => b.count - a.count));