Skip to content

Commit 6b57d5f

Browse files
authored
fix(studio): fix infinite pagination loop in queue messages (supabase#44292)
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Bug fix ## What is the current behavior? The `getNextPageParam` function in `database-queue-messages-infinite-query.ts` uses `<=` instead of `>=`, which means pagination never stops. Since the result length is always less than or equal to the page size, `hasNextPage` is always `true`, causing infinite API requests when viewing queue messages in Studio. Resolves supabase#44291 ## What is the new behavior? Uses `>=` to correctly detect when there are more pages, consistent with every other infinite query in the codebase: - `database-cron-jobs-infinite-query.ts` uses `>=` - `users-infinite-query.ts` uses `>=` - `database-cron-jobs-runs-infinite-query.ts` uses `< PAGE_SIZE` to return `undefined` (equivalent logic) ## Additional context One character change: `<=` to `>=` on line 112.
1 parent 8e10546 commit 6b57d5f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

apps/studio/data/database-queues/database-queue-messages-infinite-query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export const useQueueMessagesInfiniteQuery = <TData = DatabaseQueueData>(
109109
enabled: enabled && typeof projectRef !== 'undefined',
110110
initialPageParam: undefined,
111111
getNextPageParam(lastPage) {
112-
const hasNextPage = lastPage.length <= QUEUE_MESSAGES_PAGE_SIZE
112+
const hasNextPage = lastPage.length >= QUEUE_MESSAGES_PAGE_SIZE
113113
if (!hasNextPage) return undefined
114114
return last(lastPage)?.enqueued_at
115115
},

0 commit comments

Comments
 (0)