mirror of https://github.com/usememos/memos.git
fix(web): make memoFilterStore reactive by marking fields as observable
Fixes the root cause of non-reactive filtering. The MemoFilterState class was not marking its fields as observable in MobX, so changes to the filters array were not being tracked. Added makeObservable configuration to mark: - filters and shortcut as observable - addFilter, removeFilter, removeFiltersByFactor, clearAllFilters, setShortcut as actions This ensures that when tags are clicked and filters are added/removed, MobX observer components will re-render and fetch new data. Related to #5189 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
e0b1153269
commit
bfad0708e2
|
|
@ -7,6 +7,7 @@
|
|||
* Filters are URL-driven and shareable - copying the URL preserves the filter state.
|
||||
*/
|
||||
import { uniqBy } from "lodash-es";
|
||||
import { makeObservable, observable, action } from "mobx";
|
||||
import { StandardState } from "./base-store";
|
||||
|
||||
/**
|
||||
|
|
@ -90,6 +91,15 @@ class MemoFilterState extends StandardState {
|
|||
*/
|
||||
constructor() {
|
||||
super();
|
||||
makeObservable(this, {
|
||||
filters: observable,
|
||||
shortcut: observable,
|
||||
addFilter: action,
|
||||
removeFilter: action,
|
||||
removeFiltersByFactor: action,
|
||||
clearAllFilters: action,
|
||||
setShortcut: action,
|
||||
});
|
||||
this.initFromURL();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue