fix: keep community feed when filtering category
This commit is contained in:
@@ -246,16 +246,23 @@ const switchFeed = (feed: FeedKey) => {
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (activeFeed.value === feed && (feed !== 'topic' || activeCategoryId.value === 0)) return
|
if (activeFeed.value === feed && activeCategoryId.value === 0) return
|
||||||
activeFeed.value = feed
|
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)
|
fetchPosts(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectCategory = (category: any) => {
|
const selectCategory = (category: any) => {
|
||||||
activeFeed.value = 'topic'
|
|
||||||
activeCategoryId.value = category.id
|
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)
|
fetchPosts(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user