chore(version): update version and changelog for release 0.8.115
Deploy Development / deploy (push) Successful in 39s
Test Suite / pytest-backend (push) Successful in 35s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 12s
Test Suite / playwright-tests (push) Successful in 1m28s
Deploy Development / deploy (push) Successful in 39s
Test Suite / pytest-backend (push) Successful in 35s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 12s
Test Suite / playwright-tests (push) Successful in 1m28s
- Bumped APP_VERSION to 0.8.115 and updated the changelog to reflect changes, including the introduction of keyset pagination for the GET /api/exercises endpoint. - Enhanced the exercises router to support cursor-based pagination using cursor_updated_at and cursor_id, improving performance and user experience. - Updated frontend components to utilize the new pagination method, removing offset-based loading logic.
This commit is contained in:
1 parent
14cf8a1a53
commit
789b640ad0
7 files changed
+161
-18
No files matched your search
@@ -177,7 +177,6 @@ function ExercisesListPage() {
|
||||
const [catalogsReady, setCatalogsReady] = useState(false)
|
||||
const [listFetching, setListFetching] = useState(false)
|
||||
const [loadingMore, setLoadingMore] = useState(false)
|
||||
const [offset, setOffset] = useState(0)
|
||||
const [hasMore, setHasMore] = useState(false)
|
||||
const [searchInput, setSearchInput] = useState('')
|
||||
const [aiSearchInput, setAiSearchInput] = useState('')
|
||||
@@ -604,13 +603,11 @@ function ExercisesListPage() {
|
||||
let cancelled = false
|
||||
const run = async () => {
|
||||
setListFetching(true)
|
||||
setOffset(0)
|
||||
try {
|
||||
const batch = await api.listExercises({ ...queryBase, limit: PAGE_SIZE, offset: 0 })
|
||||
if (cancelled) return
|
||||
setExercises(batch)
|
||||
setHasMore(batch.length === PAGE_SIZE)
|
||||
setOffset(batch.length)
|
||||
} catch (err) {
|
||||
if (!cancelled) {
|
||||
console.error('Failed to load data:', err)
|
||||
@@ -628,12 +625,21 @@ function ExercisesListPage() {
|
||||
|
||||
const loadMore = async () => {
|
||||
if (loadingMore || !hasMore) return
|
||||
const last = exercises[exercises.length - 1]
|
||||
if (!last?.id || last.updated_at == null) return
|
||||
setLoadingMore(true)
|
||||
try {
|
||||
const batch = await api.listExercises({ ...queryBase, limit: PAGE_SIZE, offset })
|
||||
const batch = await api.listExercises({
|
||||
...queryBase,
|
||||
limit: PAGE_SIZE,
|
||||
cursor_updated_at:
|
||||
typeof last.updated_at === 'string'
|
||||
? last.updated_at
|
||||
: new Date(last.updated_at).toISOString(),
|
||||
cursor_id: last.id,
|
||||
})
|
||||
setExercises((prev) => [...prev, ...batch])
|
||||
setHasMore(batch.length === PAGE_SIZE)
|
||||
setOffset((o) => o + batch.length)
|
||||
} catch (err) {
|
||||
alert('Fehler: ' + err.message)
|
||||
} finally {
|
||||
|
||||
Reference in new issue
Block a user