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:
@@ -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 },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user