MCPcopy Create free account
hub / github.com/callumalpass/tasknotes / getFilterState

Method getFilterState

src/services/ViewStateManager.ts:43–72  ·  view source on GitHub ↗

* Get filter state for a specific view

(viewType: string)

Source from the content-addressed store, hash-verified

41 * Get filter state for a specific view
42 */
43 getFilterState(viewType: string): FilterQuery | undefined {
44 const state = this.filterState[viewType];
45
46 if (!state) {
47 return undefined;
48 }
49
50 // Check if state has the new FilterGroup structure (v3.13.0+)
51 // If it's old format, ignore it and return undefined to use default
52 if (
53 typeof state !== "object" ||
54 state.type !== "group" ||
55 !Array.isArray(state.children) ||
56 typeof state.conjunction !== "string"
57 ) {
58 tasknotesLogger.warn(
59 `ViewStateManager: Ignoring old format filter state for ${viewType}, will use default`,
60 {
61 category: "validation",
62 operation: "viewstatemanager-ignoring-old-format-filter-state",
63 }
64 );
65 // Clear the old format data
66 delete this.filterState[viewType];
67 this.saveToStorage();
68 return undefined;
69 }
70
71 return FilterUtils.deepCloneFilterQuery(state);
72 }
73
74 /**
75 * Set filter state for a specific view

Callers

nothing calls this directly

Calls 3

saveToStorageMethod · 0.95
warnMethod · 0.80
deepCloneFilterQueryMethod · 0.80

Tested by

no test coverage detected