Skip to content

Commit 2f6fff8

Browse files
chore: fix actions demo (#526)
Co-authored-by: Kent C. Dodds <[email protected]>
1 parent eacd4de commit 2f6fff8

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

examples/basic/app/routes/demos/actions.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useEffect, useRef } from "react";
22
import type { ActionFunction } from "remix";
3-
import { Form, json, useActionData, useTransition, redirect } from "remix";
3+
import { Form, json, useActionData, redirect } from "remix";
44

55
import { hash } from "~/utils.server";
66

@@ -19,7 +19,7 @@ export let action: ActionFunction = async ({ request }) => {
1919
// over the network. Clientside validation is fine, but you definitely need it
2020
// server side. If there's a problem, return the the data and the component
2121
// can render it.
22-
if (typeof answer !== "string") {
22+
if (!answer || typeof answer !== "string") {
2323
return json("Come on, at least try!", { status: 400 });
2424
}
2525

packages/create-remix/templates/_shared_js/app/routes/demos/actions.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export let action = async ({ request }) => {
1616
// over the network. Clientside validation is fine, but you definitely need it
1717
// server side. If there's a problem, return the the data and the component
1818
// can render it.
19-
if (typeof answer !== "string") {
19+
if (!answer || typeof answer !== "string") {
2020
return json("Come on, at least try!", { status: 400 });
2121
}
2222

packages/create-remix/templates/_shared_ts/app/routes/demos/actions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export let action: ActionFunction = async ({ request }) => {
1717
// over the network. Clientside validation is fine, but you definitely need it
1818
// server side. If there's a problem, return the the data and the component
1919
// can render it.
20-
if (typeof answer !== "string") {
20+
if (!answer || typeof answer !== "string") {
2121
return json("Come on, at least try!", { status: 400 });
2222
}
2323

0 commit comments

Comments
 (0)