Skip to content

Commit

Permalink
perf: 注文番号入力欄が重い問題を修正 (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
r4ai authored Nov 23, 2024
1 parent 92b9333 commit 21cecd1
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions app/routes/reception.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function Reception() {
const actionData = useActionData<ActionData>()
const { showMessage } = useMessage()
const { isOpen, onOpen, onClose } = useDisclosure()
const [tableNumber, setTableNumber] = useState("")
const tableNumberRef = useRef<HTMLInputElement>(null)

// const fetcher = useFetcher();

Expand All @@ -81,7 +81,7 @@ export default function Reception() {
if (orderMemoRef.current) orderMemoRef.current.value = ""
showMessage({ title: "注文しました", status: "success" })
onClose()
setTableNumber("")
if (tableNumberRef.current) tableNumberRef.current.value = ""
} else if (actionData?.success === false) {
const errorMessage = actionData.error || "エラーが発生しました"
showMessage({ title: errorMessage, status: "error" })
Expand Down Expand Up @@ -145,10 +145,6 @@ export default function Reception() {
onOpen()
}

const tableNumberChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setTableNumber(e.target.value)
}

return (
<div>
<Box left="10">
Expand Down Expand Up @@ -223,8 +219,7 @@ export default function Reception() {
<Input
type="number"
name="table_number"
onChange={tableNumberChange}
value={tableNumber}
ref={tableNumberRef}
bg="gray.300"
/>
</Text>
Expand Down

0 comments on commit 21cecd1

Please sign in to comment.