Fix item claiming not showing up immediately after RSVP submission

This commit is contained in:
2025-04-30 14:07:34 -04:00
parent 2da352ee9e
commit 20827ea95a
2 changed files with 20 additions and 5 deletions

View File

@@ -168,8 +168,14 @@ const RSVPForm: React.FC = () => {
// Get all claimed items from existing RSVPs including the new submission
const claimed = new Set<string>();
const allRsvps = [...rsvpsResponse.data, response.data];
allRsvps.forEach((rsvp: any) => {
// First add items from the new submission
if (Array.isArray(response.data.items_bringing)) {
response.data.items_bringing.forEach(item => claimed.add(item));
}
// Then add items from existing RSVPs
rsvpsResponse.data.forEach((rsvp: any) => {
try {
let rsvpItems: string[] = [];
if (typeof rsvp.items_bringing === 'string') {