From f5ca4839d36e684aaa645dec3ee334e361d2164f Mon Sep 17 00:00:00 2001 From: Regalijan Date: Tue, 3 Dec 2024 15:26:49 -0500 Subject: [PATCH] Stop client server mismatch errors --- app/routes/et-members_.strikes_.$uid.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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",