fix(web): allow only one active tag filter at a time

Previously, clicking multiple tags would add them all as active filters. Now clicking a new tag automatically clears any existing tag filters before applying the new one, ensuring only one tag can be filtered at a time. Clicking an already-active tag still deselects it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Steven 2025-12-02 08:40:43 +08:00
parent a863154224
commit 8154a411a9
3 changed files with 6 additions and 0 deletions

View File

@ -41,6 +41,8 @@ export const Tag: React.FC<TagProps> = ({ "data-tag": dataTag, children, classNa
if (isActive) {
memoFilterStore.removeFilter((f: MemoFilter) => f.factor === "tagSearch" && f.value === tag);
} else {
// Remove all existing tag filters first, then add the new one
memoFilterStore.removeFilter((f: MemoFilter) => f.factor === "tagSearch");
memoFilterStore.addFilter({
factor: "tagSearch",
value: tag,

View File

@ -27,6 +27,8 @@ const TagsSection = observer((props: Props) => {
if (isActive) {
memoFilterStore.removeFilter((f: MemoFilter) => f.factor === "tagSearch" && f.value === tag);
} else {
// Remove all existing tag filters first, then add the new one
memoFilterStore.removeFilter((f: MemoFilter) => f.factor === "tagSearch");
memoFilterStore.addFilter({
factor: "tagSearch",
value: tag,

View File

@ -101,6 +101,8 @@ const TagItemContainer = observer((props: TagItemContainerProps) => {
if (isActive) {
memoFilterStore.removeFilter((f: MemoFilter) => f.factor === "tagSearch" && f.value === tag.text);
} else {
// Remove all existing tag filters first, then add the new one
memoFilterStore.removeFilter((f: MemoFilter) => f.factor === "tagSearch");
memoFilterStore.addFilter({
factor: "tagSearch",
value: tag.text,