Skip to content

Commit 7d7c68f

Browse files
authored
fix: filtering in the case list does not update the shown cases (#2364) (#2496)
1 parent 7de812c commit 7d7c68f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

frontend/src/cases/components/CaseListTable/CaseListTable.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ const updateQuery = async ({
8484
/** Debounced version of `updateQuery`. */
8585
const updateQueryDebounced = debounce(updateQuery, 500)
8686
87+
// Watch for search changes and reset page to 1 to avoid loading non-existent pages
88+
watch(search, () => {
89+
page.value = 1
90+
})
91+
8792
// Watch for any error and emit a message on any error.
8893
watch(
8994
() => caseListRes.isError,

frontend/src/cases/queries/cases.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ export const useCaseListQuery = ({
5656
order_by: () => toValue(orderBy) ?? 'name',
5757
// @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
5858
order_dir: () => toValue(orderDir) ?? 'asc',
59-
q: toValue(queryString),
59+
// @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
60+
q: () => toValue(queryString),
6061
},
6162
}),
6263
// @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
@@ -87,7 +88,7 @@ export const useCaseCountQuery = ({
8788
},
8889
query: {
8990
// @ts-ignore // https://github.com/hey-api/openapi-ts/issues/653#issuecomment-2314847011
90-
q: queryString,
91+
q: () => toValue(queryString),
9192
},
9293
}),
9394
enabled: () => !!toValue(projectUuid),

0 commit comments

Comments
 (0)