Hotfix : Fix Infinite loading of Bookings (#2729)

* Add more embed events

* Add more embed events

* Fix nextCursor calculation logic

Co-authored-by: Peer Richelsen <peeroke@gmail.com>
pull/2725/head^2
Hariom Balhara 2022-05-11 16:05:43 +05:30 committed by GitHub
parent 0945bbe5cf
commit 19128fb08e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -371,7 +371,6 @@ const loggedInViewerRouter = createProtectedRouter()
};
const passedBookingsFilter = bookingListingFilters[bookingListingByStatus];
const orderBy = bookingListingOrderby[bookingListingByStatus];
const bookingsQuery = await prisma.booking.findMany({
where: {
OR: [
@ -440,7 +439,7 @@ const loggedInViewerRouter = createProtectedRouter()
endTime: booking.endTime.toISOString(),
};
});
const bookingsFetched = bookings.length;
const seenBookings: Record<string, boolean> = {};
// Remove duplicate recurring bookings for upcoming status.
@ -461,7 +460,8 @@ const loggedInViewerRouter = createProtectedRouter()
}
let nextCursor: typeof skip | null = skip;
if (bookings.length > take) {
if (bookingsFetched > take) {
bookings.shift();
nextCursor += bookings.length;
} else {