From 91fc114cd3064356bdfb5303431b2a2ccba73a93 Mon Sep 17 00:00:00 2001 From: RemixDev Date: Tue, 4 Jan 2022 23:05:43 +0100 Subject: [PATCH] Fixed search bug after switching tabs --- src/components/pages/Search.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/pages/Search.vue b/src/components/pages/Search.vue index 6e44c64..be05709 100644 --- a/src/components/pages/Search.vue +++ b/src/components/pages/Search.vue @@ -139,11 +139,12 @@ export default defineComponent({ }) const { searchResult, performMainSearch } = useMainSearch() const { result, performSearch } = useSearch() - const searchedTerm = computed(() => ctx.root.$route.query.term) + const cachedSearchedTerm = computed(() => searchResult.value.QUERY) + const searchedTerm = computed(() => ctx.root.$route.query.term || cachedSearchedTerm.value) const isQueryEmpty = computed(() => state.results.query === '') const isSearching = ref(false) const isMainSearchCached = computed(() => Object.keys(searchResult.value).length !== 0) - const isNewSearch = computed(() => searchResult.value.QUERY !== searchedTerm.value) + const isNewSearch = computed(() => cachedSearchedTerm.value !== searchedTerm.value) if (isMainSearchCached.value && !isNewSearch.value) { onMounted(() => {