fix: changing page_size caused bad labels on paging bar

Massimo Melina committed Mar 16, 2026 at 10:47 UTC ab538b56771889cf5318273eeec65333b9543088
1 file changed +10 -7
frontend/src/BrowseFiles.ts
+10 -7
@@ -259,13 +259,16 @@ const Paging = memo(({ nPages, current, pageSize, changePage, atBottom }: Paging
259 onClick() { changePage(0) },
260 }, hIcon('to_start')),
261 h('div', { id: 'paging-middle' }, // using sticky first/last would prevent scrollIntoView from working
262 - _.range(1, nPages).map(i =>
263 - (!shrink || !(i%10) || (i >= from && i < to)) // if shrinking, we show thousands or hundreds for current thousand
264 - && h('button', {
265 - key: i,
266 - ...i === current && { className: 'toggled', ref },
267 - onClick: () => changePage(i),
268 - }, shrink && !(i%10) ? (i/10) + 'K' : i * pageSize) )
262 + _.range(1, nPages).map(i => {
263 + if (shrink && i % 10 && (i < from || i >= to))
264 + return false
265 + const pageStart = i * pageSize
266 + return h('button', {
267 + key: i,
268 + ...i === current && { className: 'toggled', ref },
269 + onClick: () => changePage(i),
270 + }, shrink && !(i % 10) && pageStart >= 1000 ? (pageStart / 1000) + 'K' : pageStart)
271 + })
272 ),
273 h('button', {
274 title: t('go_last', "Go to last item"),