Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

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

Steven8154a411a98d
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<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,
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,