From bdc74f9c9080ebe814f1f99e9ded001536eb0160 Mon Sep 17 00:00:00 2001 From: padreug Date: Sat, 27 Sep 2025 21:23:40 +0200 Subject: [PATCH] refactor: simplify recent searches handling in MarketSearchBar - Updated recent searches logic to directly manipulate the recentSearches value, improving clarity and reducing complexity. - Changed the filtering mechanism to use a more straightforward approach, enhancing maintainability. These changes streamline the recent searches functionality, contributing to a cleaner and more efficient MarketSearchBar component. --- src/modules/market/components/MarketSearchBar.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/market/components/MarketSearchBar.vue b/src/modules/market/components/MarketSearchBar.vue index 3e45814..870160d 100644 --- a/src/modules/market/components/MarketSearchBar.vue +++ b/src/modules/market/components/MarketSearchBar.vue @@ -338,14 +338,15 @@ const applyRecentSearch = (recent: string) => { const addToRecentSearches = (query: string) => { if (!props.showEnhancements) return - const searches = recentSearches.value.value.filter(s => s !== query) + const currentSearches = recentSearches.value as string[] + const searches = currentSearches.filter((s: string) => s !== query) searches.unshift(query) - recentSearches.value.value = searches.slice(0, 10) // Keep only 10 recent searches + recentSearches.value = searches.slice(0, 10) as any // Keep only 10 recent searches } const clearRecentSearches = () => { if (props.showEnhancements) { - recentSearches.value.value = [] + recentSearches.value = [] as any } }