+10
-3
mast-react-vite/src/App.tsx
+10
-3
mast-react-vite/src/App.tsx
···
33
33
34
34
// Get current conditions and parameters for SQL query
35
35
const { conditions: newConditions, params: newParams } = getWhereClause();
36
+
37
+
const selectedItemsArray = useMemo(() => Array.from(selectedItems), [selectedItems]);
36
38
37
39
const whereClause = [
38
40
newConditions.length > 0 ? `(${newConditions.join(" AND ")})` : null,
39
41
selectedItems.size > 0 && newConditions.length > 0
40
-
? `working_id IN (${Array.from(selectedItems).join(",")})`
42
+
? `working_id IN (${selectedItemsArray.map(() => '?').join(",")})`
41
43
: null,
42
44
]
43
45
.filter(Boolean)
44
46
.join(" OR ");
45
47
46
-
console.log("updating todos: ", whereClause, "newParams: ", newParams);
48
+
const allParams = [
49
+
...newParams,
50
+
...(selectedItems.size > 0 && newConditions.length > 0 ? selectedItemsArray : [])
51
+
];
52
+
53
+
console.log("updating todos: ", whereClause, "allParams: ", allParams);
47
54
const rawTodos = useQuery(
48
55
ctx,
49
56
`SELECT * FROM urgent_todos ${whereClause ? "WHERE " + whereClause : ""}`,
50
-
newParams,
57
+
allParams,
51
58
).data;
52
59
53
60
// Convert priority field from string to boolean
+22
-3
mast-react-vite/src/contexts/filter-context.tsx
+22
-3
mast-react-vite/src/contexts/filter-context.tsx
···
54
54
// The parsed filter state is derived from the filter text
55
55
const [filterState, setFilterState] = useState<FilterState>({});
56
56
57
+
// Log whenever filterState actually changes
58
+
useEffect(() => {
59
+
console.log("🔍 FILTER: filterState updated:", filterState);
60
+
}, [filterState]);
61
+
62
+
// Log whenever filterText actually changes
63
+
useEffect(() => {
64
+
console.log("🔍 FILTER: filterText updated:", filterText);
65
+
}, [filterText]);
66
+
57
67
// Parse the filter text whenever it changes
58
68
useEffect(() => {
69
+
console.log("🔍 FILTER: filterText changed:", filterText);
59
70
if (filterText.trim() === "") {
71
+
console.log("🔍 FILTER: Clearing filter state (empty text)");
60
72
setFilterState({});
61
73
return;
62
74
}
···
89
101
newState.filterPriority = true;
90
102
}
91
103
92
-
console.log("Parsed filter command:", parsed);
93
-
console.log("New filter state:", newState);
104
+
console.log("🔍 FILTER: Parsed filter command:", parsed);
105
+
console.log("🔍 FILTER: New filter state:", newState);
94
106
95
107
setFilterState(newState);
96
108
}
···
143
155
fallbackState.filterDescription = remainingText;
144
156
}
145
157
158
+
console.log("🔍 FILTER: Using fallback filter state:", fallbackState);
146
159
setFilterState(fallbackState);
147
160
}
148
161
}, [filterText]);
149
162
150
163
// Clear all filters
151
164
const clearFilters = () => {
165
+
console.log("🔍 FILTER: clearFilters() called");
152
166
setFilterText("");
153
167
setFilterState({});
154
168
};
···
233
247
return { conditions, params };
234
248
};
235
249
250
+
const wrappedSetFilterText = (text: string) => {
251
+
console.log("🔍 FILTER: setFilterText() called with:", text);
252
+
setFilterText(text);
253
+
};
254
+
236
255
return (
237
256
<FilterContext.Provider
238
257
value={{
239
258
filterText,
240
-
setFilterText,
259
+
setFilterText: wrappedSetFilterText,
241
260
filterState,
242
261
clearFilters,
243
262
toggleProject,
+4
-1
mast-react-vite/src/contexts/selection-context.tsx
+4
-1
mast-react-vite/src/contexts/selection-context.tsx