From 7b1dd92248bde0d10f5150eaf689063ce824148d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Delafontaine?= Date: Fri, 20 Dec 2024 10:20:36 +0100 Subject: [PATCH] FIX bug chargement de page n --- components/common/results/SortingSelect.vue | 5 ++++- composables/useStrategyAPI.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/components/common/results/SortingSelect.vue b/components/common/results/SortingSelect.vue index 267c3ad..603ef35 100644 --- a/components/common/results/SortingSelect.vue +++ b/components/common/results/SortingSelect.vue @@ -19,6 +19,7 @@ const { setSorting, getItemsTri, getCurrentSorting, getTriMap } = useStrategyAPI const items = ref([]); const tri = ref(""); +let triIsInitialized = false; let noDoubleUpdates = false; onMounted(() => { @@ -83,10 +84,12 @@ function getCurrentSortName() { // Surveiller les changements de tri watch(tri, async (newSortingArray, previousSortingArray) => { - if (typeof previousSortingArray !== 'undefined' && !noDoubleUpdates) { + if (typeof previousSortingArray !== 'undefined' && !noDoubleUpdates && triIsInitialized) { setSorting(newSortingArray.cle); emit("updatePageNumberFromSortingSelect", 1); emit("search"); + } else { + triIsInitialized = true; } noDoubleUpdates = false; }); diff --git a/composables/useStrategyAPI.js b/composables/useStrategyAPI.js index 4d6e3b4..cdbc859 100644 --- a/composables/useStrategyAPI.js +++ b/composables/useStrategyAPI.js @@ -235,7 +235,7 @@ export default function() { if (domaine.value === "personnes") return queryPersonnesAPI(replaceAndEscape(query.value), getFacetsRequest(), currentPageNumber.value, currentShowingNumber.value, currentSorting.value); else - //La recherche avancée ne doit pas échapper les caractères spécieaux, on passe isAdvanced pour déterminer quels caractères échapper + //La recherche avancée ne doit pas échapper les caractères spéciaux, on passe isAdvanced pour déterminer quels caractères échapper return queryThesesAPI(replaceAndEscape(query.value, isAdvanced.value), getFacetsRequest(), currentPageNumber.value, currentShowingNumber.value, currentSorting.value); }