diff --git a/frontend/src/app/tabs/calendar/components/calendar-list-view/calendar-list-view.component.ts b/frontend/src/app/tabs/calendar/components/calendar-list-view/calendar-list-view.component.ts index 996b66ee..9f1f4ff5 100644 --- a/frontend/src/app/tabs/calendar/components/calendar-list-view/calendar-list-view.component.ts +++ b/frontend/src/app/tabs/calendar/components/calendar-list-view/calendar-list-view.component.ts @@ -7,7 +7,7 @@ import { startOfDay, startOfWeek, sub } from 'date-fns'; import { ToastController } from '@ionic/angular/standalone'; import { AngularFirestore } from '@angular/fire/compat/firestore'; -import { switchMap } from 'rxjs/operators'; +import { shareReplay, switchMap, take } from 'rxjs/operators'; import { AsyncPipe, formatDate, KeyValuePipe } from '@angular/common'; import { EventItem } from 'src/app/shared/services/event'; @@ -92,7 +92,7 @@ export class CalendarListViewComponent implements OnInit, OnChanges { return query.orderBy('eventStartDate', 'asc'); }) .valueChanges({ idField: 'id' }) - .pipe(trace('firestore')); + .pipe(trace('firestore'), take(1), shareReplay(1)); }), ); } diff --git a/frontend/src/app/tabs/calendar/components/item-list-view/item-list-view.component.ts b/frontend/src/app/tabs/calendar/components/item-list-view/item-list-view.component.ts index c61370ca..eb29fedd 100644 --- a/frontend/src/app/tabs/calendar/components/item-list-view/item-list-view.component.ts +++ b/frontend/src/app/tabs/calendar/components/item-list-view/item-list-view.component.ts @@ -6,7 +6,7 @@ import { CoursesService } from 'src/app/shared/services/courses.service'; import { startOfDay, endOfDay } from 'date-fns'; import { AngularFirestore } from '@angular/fire/compat/firestore'; -import { switchMap } from 'rxjs/operators'; +import { shareReplay, switchMap, take } from 'rxjs/operators'; import { EventItem } from 'src/app/shared/services/event'; import { trace } from '@angular/fire/compat/performance'; @@ -70,7 +70,7 @@ export class ItemListViewComponent implements OnInit, OnChanges { return query.orderBy('eventStartDate', 'asc'); }) .valueChanges({ idField: 'id' }) - .pipe(trace('firestore')); + .pipe(trace('firestore'), take(1), shareReplay(1)); }), ); }