fix: mise a jour immediate UI apres suppression en mode liste - appel triggerRefresh dans NotesTabsView
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 1m13s

Made-with: Cursor
This commit is contained in:
2026-04-26 00:20:51 +02:00
parent ce6166fa88
commit e76572ccd5
2 changed files with 4 additions and 0 deletions

View File

@@ -333,6 +333,7 @@ export function NoteInlineEditor({
startTransition(async () => {
await deleteNote(note.id)
onDelete?.(note.id)
triggerRefresh()
})
}

View File

@@ -1,6 +1,7 @@
'use client'
import { useCallback, useEffect, useState, useTransition } from 'react'
import { useNoteRefreshOptional } from '@/context/NoteRefreshContext'
import {
DndContext,
type DragEndEvent,
@@ -266,6 +267,7 @@ function SortableNoteListItem({
export function NotesTabsView({ notes, onEdit, currentNotebookId }: NotesTabsViewProps) {
const { t, language } = useLanguage()
const { triggerRefresh } = useNoteRefreshOptional()
const [items, setItems] = useState<Note[]>(notes)
const [selectedId, setSelectedId] = useState<string | null>(null)
const [isCreating, startCreating] = useTransition()
@@ -496,6 +498,7 @@ export function NotesTabsView({ notes, onEdit, currentNotebookId }: NotesTabsVie
setItems((prev) => prev.filter((n) => n.id !== noteToDelete.id))
setSelectedId((prev) => (prev === noteToDelete.id ? null : prev))
setNoteToDelete(null)
triggerRefresh()
toast.success(t('notes.deleted'))
} catch {
toast.error(t('notes.deleteFailed'))