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
@@ -53,7 +53,6 @@ export default function ExercisePickerModal({
|
||||
const [list, setList] = useState([])
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [loadingMore, setLoadingMore] = useState(false)
|
||||
const [offset, setOffset] = useState(0)
|
||||
const [hasMore, setHasMore] = useState(false)
|
||||
const [multiPicked, setMultiPicked] = useState([])
|
||||
const [quickOpen, setQuickOpen] = useState(false)
|
||||
@@ -118,7 +117,6 @@ export default function ExercisePickerModal({
|
||||
setFilters({ ...INITIAL_FILTERS })
|
||||
setFilterOpen(false)
|
||||
setList([])
|
||||
setOffset(0)
|
||||
setHasMore(false)
|
||||
setMultiPicked([])
|
||||
setQuickOpen(false)
|
||||
@@ -227,7 +225,6 @@ export default function ExercisePickerModal({
|
||||
const reload = useCallback(async () => {
|
||||
if (!open || !catalogsReady) return
|
||||
setLoading(true)
|
||||
setOffset(0)
|
||||
try {
|
||||
const batch = await api.listExercises({
|
||||
...queryBase,
|
||||
@@ -238,7 +235,6 @@ export default function ExercisePickerModal({
|
||||
})
|
||||
setList(Array.isArray(batch) ? batch : [])
|
||||
setHasMore(batch?.length === PAGE_SIZE)
|
||||
setOffset(batch?.length ?? 0)
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
alert(e.message || 'Laden fehlgeschlagen')
|
||||
@@ -255,6 +251,8 @@ export default function ExercisePickerModal({
|
||||
|
||||
const loadMore = async () => {
|
||||
if (!hasMore || loadingMore || loading) return
|
||||
const last = list[list.length - 1]
|
||||
if (!last?.id || last.updated_at == null) return
|
||||
setLoadingMore(true)
|
||||
try {
|
||||
const batch = await api.listExercises({
|
||||
@@ -262,11 +260,14 @@ export default function ExercisePickerModal({
|
||||
include_archived: true,
|
||||
include_variants: true,
|
||||
limit: PAGE_SIZE,
|
||||
offset,
|
||||
cursor_updated_at:
|
||||
typeof last.updated_at === 'string'
|
||||
? last.updated_at
|
||||
: new Date(last.updated_at).toISOString(),
|
||||
cursor_id: last.id,
|
||||
})
|
||||
setList((prev) => [...prev, ...(Array.isArray(batch) ? batch : [])])
|
||||
setHasMore(batch?.length === PAGE_SIZE)
|
||||
setOffset((o) => o + (batch?.length ?? 0))
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
alert(e.message || 'Mehr laden fehlgeschlagen')
|
||||
|
||||
Reference in new issue
Block a user