fix(keep-notes): sidebar chevron, labels sync, batch org errors, perf guards

- Notebooks: chevron visible when expanded (remove overflow clip), functional expand state
- Labels: sync/cleanup by notebookId, reconcile after note move
- Settings: refresh notebooks after cleanup; label dialog routing
- ConnectionsBadge lazy-load; reminder check persistence; i18n keys

Made-with: Cursor
This commit is contained in:
Sepehr Ramezani
2026-04-13 22:07:09 +02:00
parent fa7e166f3e
commit 39671c6472
16 changed files with 469 additions and 303 deletions

View File

@@ -443,15 +443,37 @@ Deine Antwort (nur JSON):
},
})
// Assign label to all suggested notes (updateMany doesn't support relations)
// Assign to notes: UI reads `Note.labels` (JSON string[]); relations must stay in sync
for (const noteId of suggestedLabel.noteIds) {
const note = await prisma.note.findFirst({
where: { id: noteId, userId, notebookId },
select: { labels: true },
})
if (!note) continue
let names: string[] = []
if (note.labels) {
try {
const parsed = JSON.parse(note.labels) as unknown
names = Array.isArray(parsed)
? parsed.filter((n): n is string => typeof n === 'string' && n.trim().length > 0)
: []
} catch {
names = []
}
}
const trimmed = suggestedLabel.name.trim()
if (!names.some((n) => n.toLowerCase() === trimmed.toLowerCase())) {
names = [...names, suggestedLabel.name]
}
await prisma.note.update({
where: { id: noteId },
data: {
labels: JSON.stringify(names),
labelRelations: {
connect: {
id: label.id,
},
connect: { id: label.id },
},
},
})