Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Support asynchronous member table updates
  • Loading branch information
regalijan committed Feb 27, 2024
1 parent 97bba83 commit 2f06159
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/routes/et-members.tsx
Expand Up @@ -12,6 +12,7 @@ import {
Thead,
Tr,
} from "@chakra-ui/react";
import { useState } from "react";

export async function loader({ context }: { context: RequestContext }) {
if (!context.data.current_user)
Expand Down Expand Up @@ -50,10 +51,11 @@ export default function () {
method: "DELETE",
});

location.reload();
setMemberData(memberData.filter((member) => member.id !== id));
}

const memberData = useLoaderData<typeof loader>();
const [realtimePoints, setRealtimePoints] = useState(0);
const [memberData, setMemberData] = useState(useLoaderData<typeof loader>());

return (
<Container maxW="container.lg">
Expand Down

0 comments on commit 2f06159

Please sign in to comment.