fix: label management - transaction safety, deletion sync, error handling
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 42s

- Use prisma.$transaction in auto-label-creation.service with tx client
- Fix DELETE /api/labels to properly JSON.parse + disconnect labelRelations
- Fix PUT /api/labels rename to handle JSON labels
- Graceful error handling in /api/ai/tags and /api/ai/auto-labels
- Client-side label-deleted event in home-client, notes-tabs-view, label-management-dialog

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-27 00:09:31 +02:00
parent 0a4aa47690
commit 6ff8088cc2
7 changed files with 116 additions and 59 deletions

View File

@@ -50,8 +50,12 @@ export function LabelManagementDialog(props: LabelManagementDialogProps = {}) {
const handleDeleteLabel = async (id: string) => {
try {
const labelToDelete = labels.find(l => l.id === id)
await deleteLabel(id)
triggerRefresh()
if (labelToDelete) {
window.dispatchEvent(new CustomEvent('label-deleted', { detail: { name: labelToDelete.name } }))
}
setConfirmDeleteId(null)
} catch (error) {
console.error('Failed to delete label:', error)