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); }