From 2a9416c69601e7d3cd333ef4d1b922bf4655c4a2 Mon Sep 17 00:00:00 2001 From: hajimi Date: Sun, 2 Aug 2026 18:49:59 +0800 Subject: [PATCH] fix: keep community feed when filtering category --- uniapp/src/pages/community/community.vue | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/uniapp/src/pages/community/community.vue b/uniapp/src/pages/community/community.vue index 67bc673..66fb254 100644 --- a/uniapp/src/pages/community/community.vue +++ b/uniapp/src/pages/community/community.vue @@ -246,16 +246,23 @@ const switchFeed = (feed: FeedKey) => { }) return } - if (activeFeed.value === feed && (feed !== 'topic' || activeCategoryId.value === 0)) return + if (activeFeed.value === feed && activeCategoryId.value === 0) return activeFeed.value = feed - if (feed !== 'topic') activeCategoryId.value = 0 + activeCategoryId.value = 0 + uni.removeStorageSync(COMMUNITY_ACTIVE_CATEGORY_KEY) + uni.removeStorageSync(LEGACY_COMMUNITY_ACTIVE_TAG_KEY) fetchPosts(true) } const selectCategory = (category: any) => { - activeFeed.value = 'topic' activeCategoryId.value = category.id - uni.setStorageSync(COMMUNITY_ACTIVE_CATEGORY_KEY, category.id) + if (activeFeed.value === 'topic') { + uni.setStorageSync(COMMUNITY_ACTIVE_CATEGORY_KEY, category.id) + uni.removeStorageSync(LEGACY_COMMUNITY_ACTIVE_TAG_KEY) + } else { + uni.removeStorageSync(COMMUNITY_ACTIVE_CATEGORY_KEY) + uni.removeStorageSync(LEGACY_COMMUNITY_ACTIVE_TAG_KEY) + } fetchPosts(true) }