From 64ad6d012c795e9cd8327ae0d99889f8199a12f5 Mon Sep 17 00:00:00 2001 From: Ivar Nakken Date: Thu, 12 Dec 2024 15:01:39 +0100 Subject: [PATCH] Re-fetch events when logging in In case the user is on the /events page and logs in, the events should be re-fetched to get the user registration statuses. --- app/routes/events/components/EventList.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/routes/events/components/EventList.tsx b/app/routes/events/components/EventList.tsx index 1cabc3b3ce..55685cdc9f 100644 --- a/app/routes/events/components/EventList.tsx +++ b/app/routes/events/components/EventList.tsx @@ -17,7 +17,7 @@ import EmptyState from 'app/components/EmptyState'; import EventItem from 'app/components/EventItem'; import { CheckBox, SelectInput } from 'app/components/Form/'; import { EventTime } from 'app/models'; -import { useCurrentUser } from 'app/reducers/auth'; +import { useCurrentUser, useIsLoggedIn } from 'app/reducers/auth'; import { selectAllEvents } from 'app/reducers/events'; import { selectPaginationNext } from 'app/reducers/selectors'; import { useAppDispatch, useAppSelector } from 'app/store/hooks'; @@ -134,6 +134,7 @@ const EventList = () => { ); const icalToken = useCurrentUser()?.icalToken; + const loggedIn = useIsLoggedIn(); const fetchQuery = { date_after: moment().format('YYYY-MM-DD'), @@ -162,7 +163,7 @@ const EventList = () => { query: fetchQuery, }), ), - [], + [loggedIn], ); const fetchMore = () =>