From ef73a9cea00ef0b20d9da0b1760fe06c1b9d309a Mon Sep 17 00:00:00 2001 From: siddharthd Date: Sat, 14 Mar 2026 21:33:25 +1100 Subject: [PATCH] fix(payment): participantId stuck as empty string when participants load async --- src/app/transactions/page.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/app/transactions/page.tsx b/src/app/transactions/page.tsx index 9f1f9f0..5d0e195 100644 --- a/src/app/transactions/page.tsx +++ b/src/app/transactions/page.tsx @@ -221,6 +221,12 @@ function MarkAsPaymentModal({ const others = participants.filter((p) => p.name !== "Me"); const [participantId, setParticipantId] = useState(others[0]?.id ?? ""); + + useEffect(() => { + if (participantId === "" && others.length > 0) { + setParticipantId(others[0].id); + } + }, [others]); // For credits/refunds the default direction is "they paid me" const [direction, setDirection] = useState<"received" | "sent">( SPEND_TYPES.has(transaction.transaction_type) ? "sent" : "received"