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
parent
0945bbe5cf
commit
19128fb08e
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue