Commit b6e642f
committed
fix(webapp): correct backward pagination slice on session list
Devin catch on #3417 — the ClickHouse sessions list was slicing
`sessionIds.slice(1, size + 1)` on the backward path, which skipped
the item closest to the cursor and surfaced the sentinel (the
`size+1`th item that proves hasMore=true) to the user.
Trace, with items c01…c11 and cursor=c07 (page size 3):
- Backward query: `session_id > c07 ORDER BY ASC LIMIT 4` →
`[c08, c09, c10, c11]`. Legitimate content is the first three
(`[c08, c09, c10]`); `c11` is the sentinel.
- Previous slice: `[c09, c10, c11]` → displayed DESC `[c11, c10, c09]`
— user never sees c08, sees sentinel c11 instead.
Fix: collapse both directions to `sessionIds.slice(0, size)`. The
sentinel is always the last item regardless of direction, so the two
branches had no reason to diverge. Cursor computations
(`previousCursor = reversed.at(1)`, `nextCursor = reversed.at(size)`)
already line up with the corrected slice — no change needed there.
Verified: webapp typecheck clean.1 parent 84d3db1 commit b6e642f
1 file changed
Lines changed: 6 additions & 4 deletions
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
| |||
0 commit comments