From 5e8c4a6cee6781c179f2ad54bcf465e74cdf9c0d Mon Sep 17 00:00:00 2001 From: aliyyanWijaya <121535030+aliyyanWijaya@users.noreply.github.com> Date: Mon, 3 Nov 2025 15:52:17 +1300 Subject: [PATCH] fix: Update the random button flow (#6248) Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com> --- .../RecipeExplorerPageSearch.vue | 31 ++++++++++++++++--- .../composables/use-recipe-explorer-search.ts | 11 +++++++ 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/frontend/components/Domain/Recipe/RecipeExplorerPage/RecipeExplorerPageParts/RecipeExplorerPageSearch.vue b/frontend/components/Domain/Recipe/RecipeExplorerPage/RecipeExplorerPageParts/RecipeExplorerPageSearch.vue index a90d78032..cb2951402 100644 --- a/frontend/components/Domain/Recipe/RecipeExplorerPage/RecipeExplorerPageParts/RecipeExplorerPageSearch.vue +++ b/frontend/components/Domain/Recipe/RecipeExplorerPage/RecipeExplorerPageParts/RecipeExplorerPageSearch.vue @@ -53,10 +53,23 @@ :active="state.orderBy === v.value" slim density="comfortable" - :prepend-icon="v.icon" - :title="v.name" - @click="setOrderBy(v.value)" - /> + @click="v.value === 'random' ? setRandomOrderByWrapper() : setOrderBy(v.value)" + > + + + + @@ -131,6 +144,7 @@ const $auth = useMealieAuth(); const route = useRoute(); const { $globals } = useNuxtApp(); const i18n = useI18n(); +const showRandomLoading = ref(false); const groupSlug = computed(() => route.params.groupSlug as string || $auth.user.value?.groupSlug || ""); @@ -141,6 +155,7 @@ const { reset, toggleOrderDirection, setOrderBy, + setRandomOrderBy, filterItems, initialize, } = useRecipeExplorerSearch(groupSlug); @@ -205,6 +220,14 @@ const input: Ref = ref(null); function hideKeyboard() { input.value?.blur(); } + +// function to show refresh icon +async function setRandomOrderByWrapper() { + if (!showRandomLoading.value) { + showRandomLoading.value = true; + } + await setRandomOrderBy(); +}