fix: Explorer Page State Not Working On Hitting Back (#6171)

This commit is contained in:
Michael Genson authored and GitHub committed 2025-09-14 22:28:17 -05:00
1 parent 9a0525c3a0
commit db2c14093d
1 file changed
+6 -1
@@ -121,7 +121,7 @@
<script setup lang="ts">
import RecipeExplorerPageSearchFilters from "./RecipeExplorerPageSearchFilters.vue";
import { useRecipeExplorerSearch } from "~/composables/use-recipe-explorer-search";
import { useRecipeExplorerSearch, clearRecipeExplorerSearchState } from "~/composables/use-recipe-explorer-search";
const emit = defineEmits<{
ready: [];
@@ -155,6 +155,11 @@ onMounted(async () => {
emit("ready");
});
onUnmounted(() => {
// Clear the cache when component unmounts to ensure fresh state on remount
clearRecipeExplorerSearchState(groupSlug.value);
});
const sortText = computed(() => {
const sort = sortable.value.find(s => s.value === state.value.orderBy);
if (!sort) return "";