Closed parkerdavis1 closed 1 year ago
I didn't change anything here but now there's a typescript error on status. I'm having trouble finding the fortitude to deal with TS.
You just need to add an as const
assertion to the json return value on line 137 so it can treat the status string as an instance of the enum, and an empty conflictEvents
array to return cases that don't have conflictEvents
so the data returned from the action has a consistent shape
diff --git a/app/routes/admin+/_horses+/horses.edit.$horseId.tsx b/app/routes/admin+/_horses+/horses.edit.$horseId.tsx
index 057bedf..510b4a8 100644
--- a/app/routes/admin+/_horses+/horses.edit.$horseId.tsx
+++ b/app/routes/admin+/_horses+/horses.edit.$horseId.tsx
@@ -58,13 +58,14 @@ export async function action({ request, params }: DataFunctionArgs) {
})
if (submission.intent !== 'submit') {
- return json({ status: 'idle', submission } as const)
+ return json({ status: 'idle', submission, conflictEvents: [] } as const)
}
if (!submission.value) {
return json(
{
status: 'error',
submission,
+ conflictEvents: [],
} as const,
{ status: 400 },
)
@@ -134,7 +135,7 @@ export async function action({ request, params }: DataFunctionArgs) {
status: 'idle',
submission,
conflictEvents,
- })
+ } as const)
}
}
Are things ready to merge otherwise?
Continuing on from PR https://github.com/opportunity-hack/evs/pull/40
Removes horse from events during cooldown period.
The events are displayed as list of links.