Skip to content

Commit

Permalink
refactor: Remove delay function in usePosts hook
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tomek-i committed Aug 29, 2024
1 parent 73496a9 commit a460ca1
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/components/hooks/usePosts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<PostType<Frontmatter>[]>();
const [tags, setTags] = useState<TagCount[]>();
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit a460ca1

Please sign in to comment.