File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
apps/webapp/app/services/runsRepository Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,11 @@ export class ClickHouseRunsRepository implements IRunsRepository {
101101 previousCursor = reversedRunIds . at ( 1 ) ?? null ;
102102 nextCursor = reversedRunIds . at ( options . page . size ) ?? null ;
103103 } else {
104- nextCursor = reversedRunIds . at ( options . page . size - 1 ) ?? null ;
104+ // Use the last item (oldest run) as the forward cursor.
105+ // We can't use a fixed index (pageSize - 1) because the result set
106+ // may have fewer items than pageSize (e.g., when new runs were created
107+ // while the user was browsing, shifting page boundaries).
108+ nextCursor = reversedRunIds . at ( reversedRunIds . length - 1 ) ?? null ;
105109 }
106110
107111 break ;
Original file line number Diff line number Diff line change @@ -75,7 +75,11 @@ export class PostgresRunsRepository implements IRunsRepository {
7575 previousCursor = reversedRuns . at ( 1 ) ?. id ?? null ;
7676 nextCursor = reversedRuns . at ( options . page . size ) ?. id ?? null ;
7777 } else {
78- nextCursor = reversedRuns . at ( options . page . size - 1 ) ?. id ?? null ;
78+ // Use the last item (oldest run) as the forward cursor.
79+ // We can't use a fixed index (pageSize - 1) because the result set
80+ // may have fewer items than pageSize (e.g., when new runs were created
81+ // while the user was browsing, shifting page boundaries).
82+ nextCursor = reversedRuns . at ( reversedRuns . length - 1 ) ?. id ?? null ;
7983 }
8084 break ;
8185 }
You can’t perform that action at this time.
0 commit comments