From 8154a411a98df22d08969e2ae92501a44eb0debd Mon Sep 17 00:00:00 2001 From: Steven Date: Tue, 2 Dec 2025 08:40:43 +0800 Subject: [PATCH] fix(web): allow only one active tag filter at a time MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- web/src/components/MemoContent/Tag.tsx | 2 ++ web/src/components/MemoExplorer/TagsSection.tsx | 2 ++ web/src/components/TagTree.tsx | 2 ++ 3 files changed, 6 insertions(+) diff --git a/web/src/components/MemoContent/Tag.tsx b/web/src/components/MemoContent/Tag.tsx index ece2224a8..92a112ceb 100644 --- a/web/src/components/MemoContent/Tag.tsx +++ b/web/src/components/MemoContent/Tag.tsx @@ -41,6 +41,8 @@ export const Tag: React.FC = ({ "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, diff --git a/web/src/components/MemoExplorer/TagsSection.tsx b/web/src/components/MemoExplorer/TagsSection.tsx index 244be2c30..3ec0d9cd4 100644 --- a/web/src/components/MemoExplorer/TagsSection.tsx +++ b/web/src/components/MemoExplorer/TagsSection.tsx @@ -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, diff --git a/web/src/components/TagTree.tsx b/web/src/components/TagTree.tsx index a7c35114d..50ce524c2 100644 --- a/web/src/components/TagTree.tsx +++ b/web/src/components/TagTree.tsx @@ -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,