mirror of https://github.com/usememos/memos.git
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:
parent
a863154224
commit
8154a411a9
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue