mirror of
https://github.com/R0m1k3/noteflow.git
synced 2026-10-22 22:58:15 +02:00
debug: add temporary debug logging to identify notes filter issue
Added console.log statements and temporary debug UI panel to help diagnose why notes are not displaying. This includes: - Logging total notes count and active filters - Logging which specific filter is excluding each note - Visual debug panel showing filter state in the UI This is temporary debugging code to resolve the issue reported by the user where no notes are displaying.
This commit is contained in:
1 file changed
+37
-3
+37
-3
@@ -857,14 +857,25 @@ const Index = () => {
|
|||||||
).values()
|
).values()
|
||||||
).sort((a, b) => a.name.localeCompare(b.name));
|
).sort((a, b) => a.name.localeCompare(b.name));
|
||||||
|
|
||||||
|
// Debug logging
|
||||||
|
console.log('=== NOTES FILTER DEBUG ===');
|
||||||
|
console.log('Total notes:', notes.length);
|
||||||
|
console.log('Show archived:', showArchived);
|
||||||
|
console.log('Search query:', searchQuery);
|
||||||
|
console.log('Search filters:', searchFilters);
|
||||||
|
|
||||||
const filteredNotes = notes.filter(note => {
|
const filteredNotes = notes.filter(note => {
|
||||||
// Archived filter
|
// Archived filter
|
||||||
if (showArchived ? !note.archived : note.archived) return false;
|
if (showArchived ? !note.archived : note.archived) {
|
||||||
|
console.log('Note filtered by archived status:', note.id, note.title);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Text search
|
// Text search
|
||||||
if (searchQuery !== "" &&
|
if (searchQuery !== "" &&
|
||||||
!(note.title && note.title.toLowerCase().includes(searchQuery.toLowerCase())) &&
|
!(note.title && note.title.toLowerCase().includes(searchQuery.toLowerCase())) &&
|
||||||
!(note.content && note.content.toLowerCase().includes(searchQuery.toLowerCase()))) {
|
!(note.content && note.content.toLowerCase().includes(searchQuery.toLowerCase()))) {
|
||||||
|
console.log('Note filtered by search query:', note.id, note.title);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -872,6 +883,7 @@ const Index = () => {
|
|||||||
if (searchFilters.tags.length > 0) {
|
if (searchFilters.tags.length > 0) {
|
||||||
const noteTags = (note.tags || []).map(t => t.name);
|
const noteTags = (note.tags || []).map(t => t.name);
|
||||||
if (!searchFilters.tags.some(filterTag => noteTags.includes(filterTag))) {
|
if (!searchFilters.tags.some(filterTag => noteTags.includes(filterTag))) {
|
||||||
|
console.log('Note filtered by tags:', note.id, note.title);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -882,38 +894,51 @@ const Index = () => {
|
|||||||
if (searchFilters.dateFrom) {
|
if (searchFilters.dateFrom) {
|
||||||
const fromDate = new Date(searchFilters.dateFrom);
|
const fromDate = new Date(searchFilters.dateFrom);
|
||||||
fromDate.setHours(0, 0, 0, 0);
|
fromDate.setHours(0, 0, 0, 0);
|
||||||
if (noteDate < fromDate) return false;
|
if (noteDate < fromDate) {
|
||||||
|
console.log('Note filtered by dateFrom:', note.id, note.title);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (searchFilters.dateTo) {
|
if (searchFilters.dateTo) {
|
||||||
const toDate = new Date(searchFilters.dateTo);
|
const toDate = new Date(searchFilters.dateTo);
|
||||||
toDate.setHours(23, 59, 59, 999);
|
toDate.setHours(23, 59, 59, 999);
|
||||||
if (noteDate > toDate) return false;
|
if (noteDate > toDate) {
|
||||||
|
console.log('Note filtered by dateTo:', note.id, note.title);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Has todos filter
|
// Has todos filter
|
||||||
if (searchFilters.hasTodos && (!note.todos || note.todos.length === 0)) {
|
if (searchFilters.hasTodos && (!note.todos || note.todos.length === 0)) {
|
||||||
|
console.log('Note filtered by hasTodos:', note.id, note.title);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Has images filter
|
// Has images filter
|
||||||
if (searchFilters.hasImages && (!note.images || note.images.length === 0)) {
|
if (searchFilters.hasImages && (!note.images || note.images.length === 0)) {
|
||||||
|
console.log('Note filtered by hasImages:', note.id, note.title);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Has files filter
|
// Has files filter
|
||||||
if (searchFilters.hasFiles && (!note.files || note.files.length === 0)) {
|
if (searchFilters.hasFiles && (!note.files || note.files.length === 0)) {
|
||||||
|
console.log('Note filtered by hasFiles:', note.id, note.title);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Priority filter
|
// Priority filter
|
||||||
if (searchFilters.priority && !note.priority) {
|
if (searchFilters.priority && !note.priority) {
|
||||||
|
console.log('Note filtered by priority:', note.id, note.title);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log('Filtered notes:', filteredNotes.length);
|
||||||
|
console.log('========================');
|
||||||
|
|
||||||
// Pagination for notes
|
// Pagination for notes
|
||||||
const totalNotesPages = Math.ceil(filteredNotes.length / NOTES_PER_PAGE);
|
const totalNotesPages = Math.ceil(filteredNotes.length / NOTES_PER_PAGE);
|
||||||
const paginatedNotes = filteredNotes.slice(
|
const paginatedNotes = filteredNotes.slice(
|
||||||
@@ -1275,6 +1300,15 @@ const Index = () => {
|
|||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div className="flex items-center gap-4">
|
<div className="flex items-center gap-4">
|
||||||
<h2 className="text-2xl font-semibold">Mes Notes</h2>
|
<h2 className="text-2xl font-semibold">Mes Notes</h2>
|
||||||
|
|
||||||
|
{/* DEBUG PANEL - TEMPORARY */}
|
||||||
|
<div className="bg-red-100 border border-red-400 rounded p-2 text-xs">
|
||||||
|
<div><strong>DEBUG:</strong> Total: {notes.length} | Filtered: {filteredNotes.length}</div>
|
||||||
|
<div>Archived: {showArchived ? 'YES' : 'NO'} | Query: '{searchQuery}'</div>
|
||||||
|
<div>Tags: {searchFilters.tags.length} | Dates: {searchFilters.dateFrom ? 'FROM' : ''} {searchFilters.dateTo ? 'TO' : ''}</div>
|
||||||
|
<div>hasTodos: {String(searchFilters.hasTodos)} | hasImages: {String(searchFilters.hasImages)} | hasFiles: {String(searchFilters.hasFiles)} | priority: {String(searchFilters.priority)}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
<Button
|
<Button
|
||||||
variant={!showArchived ? "default" : "outline"}
|
variant={!showArchived ? "default" : "outline"}
|
||||||
|
|||||||
Reference in new issue
Block a user