Skip to content

Commit d44c540

Browse files
committed
fix: force first page when filters change
1 parent 1c589a5 commit d44c540

2 files changed

Lines changed: 25 additions & 2 deletions

File tree

frontend/src/modules/member/pages/member-list-page.vue

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ const membersQueryKey = computed(() => [
153153
queryParams.value.offset,
154154
queryParams.value.limit,
155155
queryParams.value.orderBy,
156-
selectedProjectGroup.value?.id ? [selectedProjectGroup.value.id] : [],
156+
queryParams.value.segments,
157157
]);
158158
159159
// Query for members list with caching
@@ -232,6 +232,7 @@ const fetch = ({
232232
offset: 0,
233233
limit: pagination.value.perPage,
234234
orderBy: orderBy || 'activityCount_DESC',
235+
segments: selectedProjectGroup.value?.id ? [selectedProjectGroup.value.id] : [],
235236
...body,
236237
};
237238
@@ -252,6 +253,17 @@ const onPaginationChange = ({
252253
pagination.value.perPage = perPage;
253254
};
254255
256+
// Watch for filter changes to ensure cache invalidation
257+
watch(
258+
filters,
259+
() => {
260+
// Reset to first page when filters change
261+
pagination.value.page = 1;
262+
queryParams.value.offset = 0;
263+
},
264+
{ deep: true },
265+
);
266+
255267
watch(
256268
selectedProjectGroup,
257269
(newProjectGroup, oldProjectGroup) => {

frontend/src/modules/organization/pages/organization-list-page.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ const organizationsQueryKey = computed(() => [
150150
queryParams.value.offset,
151151
queryParams.value.limit,
152152
queryParams.value.orderBy,
153-
selectedProjectGroup.value?.id ? [selectedProjectGroup.value.id] : [],
153+
queryParams.value.segments,
154154
]);
155155
156156
// Query for organizations list with caching
@@ -249,6 +249,17 @@ const onPaginationChange = ({
249249
pagination.value.perPage = perPage;
250250
};
251251
252+
// Watch for filter changes to ensure cache invalidation
253+
watch(
254+
filters,
255+
() => {
256+
// Reset to first page when filters change
257+
pagination.value.page = 1;
258+
queryParams.value.offset = 0;
259+
},
260+
{ deep: true },
261+
);
262+
252263
watch(
253264
selectedProjectGroup,
254265
(newProjectGroup, oldProjectGroup) => {

0 commit comments

Comments
 (0)