From 9fa1bdaba8ed5e60c2532d53767e3660609c10d8 Mon Sep 17 00:00:00 2001 From: NathanLe2247 Date: Tue, 27 Oct 2026 19:25:38 -0400 Subject: [PATCH] Refresh All RSVPs after submitting and skip the unauthorized list fetch After a user submitted or updated their RSVP, only the "Your RSVP" card refreshed, so the All RSVPs list stayed stale until the page was reopened. Now the list is refetched after a successful submit for users who can see it. The page-change effect also ran on first render for every user. Users without event management permission got a "Failed to fetch RSVPs" toast, and managers fetched page 1 twice. It now only fetches when the list is shown. Co-Authored-By: Claude Opus 5.5 --- .../webui/src/components/fabric/EventAttendance.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/peopleportal/webui/src/components/fabric/EventAttendance.tsx b/peopleportal/webui/src/components/fabric/EventAttendance.tsx index 6619dd9..7820ec8 100644 --- a/peopleportal/webui/src/components/fabric/EventAttendance.tsx +++ b/peopleportal/webui/src/components/fabric/EventAttendance.tsx @@ -480,6 +480,9 @@ export const EventAttendance = () => { ); if (rsvpRes.ok) { setRsvp((await rsvpRes.json()).rsvp); + if (showRsvps) { + refreshList(); + } } else { toast.error(`Failed to refresh RSVP: ${rsvpRes.statusText}`); return; @@ -593,7 +596,10 @@ export const EventAttendance = () => { }); }; React.useEffect(() => { - refreshList(); + // load() already fetches page 1; only refetch on page changes for users who can see the list + if (showRsvps) { + refreshList(); + } }, [debouncedPage]); return (