fix: keep community feed when filtering category

This commit is contained in:
hajimi
2026-08-02 18:49:59 +08:00
parent 3c2dddd6d1
commit 2a9416c696
+11 -4
View File
@@ -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)
}