1
0
Fork 0
mirror of https://framagit.org/framasoft/mobilizon.git synced 2024-12-26 09:49:12 +00:00

fix(front): reset page number to 1 when search criteria changes

Closes #1272

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2023-05-24 10:56:02 +02:00
parent 3eddd5fc8f
commit d73bafec97
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -868,20 +868,6 @@ const contentType = useRouteQuery(
enumTransformer(ContentType)
);
watch(contentType, (newContentType: ContentType) => {
switch (newContentType) {
case ContentType.ALL:
page.value = 1;
break;
case ContentType.EVENTS:
eventPage.value = 1;
break;
case ContentType.GROUPS:
groupPage.value = 1;
break;
}
});
const isOnline = useRouteQuery("isOnline", false, booleanTransformer);
const categoryOneOf = useRouteQuery("categoryOneOf", [], arrayTransformer);
const statusOneOf = useRouteQuery(
@ -1261,6 +1247,40 @@ const boostLanguagesQuery = computed((): string[] => {
return Array.from(languages);
});
// When search criteria changes, reset page number to 1
watch(
[
contentType,
searchDebounced,
geoHashLocation,
start,
end,
radius,
isOnline,
categoryOneOf,
statusOneOf,
languageOneOf,
searchTarget,
bbox,
zoom,
sortBy,
boostLanguagesQuery,
],
([newContentType]) => {
switch (newContentType) {
case ContentType.ALL:
page.value = 1;
break;
case ContentType.EVENTS:
eventPage.value = 1;
break;
case ContentType.GROUPS:
groupPage.value = 1;
break;
}
}
);
const { result: searchElementsResult, loading: searchLoading } = useQuery<{
searchEvents: Paginate<TypeNamed<IEvent>>;
searchGroups: Paginate<TypeNamed<IGroup>>;