* Get filter state for a specific view
(viewType: string)
| 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 |
nothing calls this directly
no test coverage detected