diff --git a/app/routes/et-members_.strikes_.$uid.tsx b/app/routes/et-members_.strikes_.$uid.tsx index 88bad4c..b23745b 100644 --- a/app/routes/et-members_.strikes_.$uid.tsx +++ b/app/routes/et-members_.strikes_.$uid.tsx @@ -24,7 +24,7 @@ import { } from "@chakra-ui/react"; import { LoaderFunctionArgs } from "@remix-run/cloudflare"; import { useLoaderData } from "@remix-run/react"; -import { useState } from "react"; +import { useEffect, useState } from "react"; export async function loader({ context, @@ -60,11 +60,15 @@ export async function loader({ export default function () { const { can_manage, strikes, user } = useLoaderData(); - const [strikeData, setStrikeData] = useState(strikes); + const [strikeData, setStrikeData] = useState([] as typeof strikes); const toast = useToast(); const [rmStrikeId, setRmStrikeId] = useState(""); const [strikeReason, setStrikeReason] = useState(""); + useEffect(() => { + setStrikeData(strikes); + }, []); + async function removeStrike(id: string) { const removeResp = await fetch(`/api/events-team/strikes/${id}`, { method: "DELETE",