diff --git a/frontend/components/Domain/Recipe/RecipeCardSection.vue b/frontend/components/Domain/Recipe/RecipeCardSection.vue index e9a5c9e63..10a29ec4f 100644 --- a/frontend/components/Domain/Recipe/RecipeCardSection.vue +++ b/frontend/components/Domain/Recipe/RecipeCardSection.vue @@ -414,15 +414,8 @@ export default defineNuxtComponent({ loading.value = false; } - const seededQuery = computed(() => { - return { - ...props.query, - _searchSeed: Date.now().toString(), - }; - }); - async function navigateRandom() { - const recipe = await getRandom(seededQuery.value, queryFilter.value); + const recipe = await getRandom(props.query, queryFilter.value); if (!recipe?.slug) { return; } diff --git a/frontend/composables/recipes/use-recipes.ts b/frontend/composables/recipes/use-recipes.ts index 104e7403d..f89780622 100644 --- a/frontend/composables/recipes/use-recipes.ts +++ b/frontend/composables/recipes/use-recipes.ts @@ -90,6 +90,8 @@ export const useLazyRecipes = function (publicGroupSlug: string | null = null) { } async function getRandom(query: RecipeSearchQuery | null = null, queryFilter: string | null = null) { + query = query || {}; + query._searchSeed = query._searchSeed || Date.now().toString(); const { data } = await api.recipes.getAll(1, 1, getParams("random", "desc", null, query, queryFilter)); if (data?.items.length) { return data.items[0];