diff --git a/app/routes/admin.sports-seasons.$id.participants.tsx b/app/routes/admin.sports-seasons.$id.participants.tsx
index da8fbd4..2143e5f 100644
--- a/app/routes/admin.sports-seasons.$id.participants.tsx
+++ b/app/routes/admin.sports-seasons.$id.participants.tsx
@@ -69,17 +69,17 @@ export async function action({ request, params }: Route.ActionArgs) {
const newName = formData.get("newName");
if (typeof participantId !== "string") {
- return { error: "Invalid participant" };
+ return { error: "Invalid participant", intent: "update-name" };
}
if (typeof newName !== "string" || !newName.trim()) {
- return { error: "Name is required" };
+ return { error: "Name is required", intent: "update-name" };
}
const trimmedName = newName.trim();
const existing = await findParticipantByName(params.id, trimmedName);
if (existing && existing.id !== participantId) {
- return { error: `"${trimmedName}" already exists in this season.` };
+ return { error: `"${trimmedName}" already exists in this season.`, intent: "update-name" };
}
try {
@@ -87,7 +87,7 @@ export async function action({ request, params }: Route.ActionArgs) {
return { success: true, intent: "update-name" };
} catch (error) {
logger.error("Error updating participant:", error);
- return { error: "Failed to update participant. Please try again." };
+ return { error: "Failed to update participant. Please try again.", intent: "update-name" };
}
}
@@ -171,16 +171,16 @@ export async function action({ request, params }: Route.ActionArgs) {
export default function ManageParticipants({ loaderData, actionData }: Route.ComponentProps) {
const { sportsSeason, participants } = loaderData;
- const [editingId, setEditingId] = useState
{actionData.error}
+ )} +