From 60a6a39e5da9841db4a892d1e3a0b00356f08009 Mon Sep 17 00:00:00 2001
From: Michael Hunteman <michael@huntm.net>
Date: Fri, 26 Apr 2024 14:26:46 -0700
Subject: Show one less than party size

---
 src/components/RsvpForm.tsx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'src')

diff --git a/src/components/RsvpForm.tsx b/src/components/RsvpForm.tsx
index b9dd991..9e957f8 100644
--- a/src/components/RsvpForm.tsx
+++ b/src/components/RsvpForm.tsx
@@ -63,10 +63,10 @@ function RsvpForm() {
   });
 
   const handleParty = () => {
-    const partySize = Number(watch('partySize'));
+    const partySize = Number(watch('partySize')) - 1;
     if (
       partySize > previousPartySize.current &&
-      partySize > 1 &&
+      partySize > 0 &&
       partySize < 10
     ) {
       append(
@@ -76,7 +76,7 @@ function RsvpForm() {
         })
       );
       previousPartySize.current = partySize;
-    } else if (partySize < previousPartySize.current && partySize > 0) {
+    } else if (partySize < previousPartySize.current && partySize >= 0) {
       remove(
         [...Array(previousPartySize.current - partySize).keys()].map(
           (_, i) => partySize - 1 + i
-- 
cgit v1.2.3