Skip to content

Commit

Permalink
prevent wiping fetched calendar events
Browse files Browse the repository at this point in the history
  • Loading branch information
lucia-gomez committed Sep 17, 2024
1 parent 9412856 commit 31af26a
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ export default function fetchCalendarEvents(allRooms: RoomSetting[]) {
Promise.all(allRooms.map(fetchRoomCalendarEvents)).then(
(results) => {
const flatResults = results.flat();
console.log(
"FETCHED CALENDAR RESULTS FOR EACH ROOM (flat)",
flatResults
);
console.log("FETCHED CALENDAR RESULTS:", flatResults.length);
const filtered = flatResults.filter(
(event) =>
!CALENDAR_HIDE_STATUS.some((hideStatus) =>
event.title?.includes(hideStatus)
)
);
console.log("FILTERED", filtered);
setEvents(filtered);
if (filtered.length === 0 && events.length > 0) {
console.log("!!! RE-FETCHING CALENDAR EVENTS WAS EMPTY !!!");
} else {
setEvents(filtered);
}
}
// setEvents(
// [...results.flat()].filter(
Expand Down

0 comments on commit 31af26a

Please sign in to comment.