From b9dc6a1ee1775141e495222b9e378a8c3c93c0aa Mon Sep 17 00:00:00 2001 From: Flosrn Date: Fri, 12 Jan 2024 13:25:54 +0100 Subject: [PATCH] fix ts errors --- .../board/remove-from-board-button.tsx | 16 +++++++++------- .../[username]/components/delete-button.tsx | 4 +++- src/components/hero/stars-particles.tsx | 5 +++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/app/(community)/profile/[username]/components/board/remove-from-board-button.tsx b/app/(community)/profile/[username]/components/board/remove-from-board-button.tsx index 4cb510a1..b201985e 100644 --- a/app/(community)/profile/[username]/components/board/remove-from-board-button.tsx +++ b/app/(community)/profile/[username]/components/board/remove-from-board-button.tsx @@ -64,13 +64,15 @@ const RemoveFromBoardButton = ({ ) => { event.preventDefault(); try { - selectedPosters.map(async (posterId) => { - addToRemoveFromBoard(posterId); - await removeFromMutation.mutateAsync({ - posterId, - boardId, - }); - }); + await Promise.all( + selectedPosters.map(async (posterId) => { + addToRemoveFromBoard(posterId); + await removeFromMutation.mutateAsync({ + posterId, + boardId, + }); + }) + ); clearSelectedPosters(); clearToRemoveFromBoard(); } catch { diff --git a/app/(community)/profile/[username]/components/delete-button.tsx b/app/(community)/profile/[username]/components/delete-button.tsx index ed2bd12b..66e62825 100644 --- a/app/(community)/profile/[username]/components/delete-button.tsx +++ b/app/(community)/profile/[username]/components/delete-button.tsx @@ -43,7 +43,9 @@ const DeleteButton = ({ isSelectedPostersEmpty }: DeleteButtonProps) => { const handleDelete = async (event: React.MouseEvent) => { event.preventDefault(); try { - selectedPosters.map(async (id) => deleteMutation.mutateAsync(id)); + await Promise.all( + selectedPosters.map(async (id) => deleteMutation.mutateAsync(id)) + ); clearSelectedPosters(); toggleSelectBar(); } catch { diff --git a/src/components/hero/stars-particles.tsx b/src/components/hero/stars-particles.tsx index e72d822f..2cfccdd4 100644 --- a/src/components/hero/stars-particles.tsx +++ b/src/components/hero/stars-particles.tsx @@ -1,7 +1,7 @@ "use client"; import React, { useCallback } from "react"; -import Particles from "react-particles"; +import { Particles } from "react-particles"; import { loadFull } from "tsparticles"; import type { Engine } from "tsparticles-engine"; @@ -9,7 +9,8 @@ type StarsParticlesProps = {}; const StarsParticles = ({}: StarsParticlesProps) => { const particlesInit = useCallback(async (engine: Engine) => { - await loadFull(engine); + // @ts-expect-error - no types for this + return await loadFull(engine); }, []); return (