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
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 1m13s
Made-with: Cursor
This commit is contained in:
@@ -333,6 +333,7 @@ export function NoteInlineEditor({
|
|||||||
startTransition(async () => {
|
startTransition(async () => {
|
||||||
await deleteNote(note.id)
|
await deleteNote(note.id)
|
||||||
onDelete?.(note.id)
|
onDelete?.(note.id)
|
||||||
|
triggerRefresh()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useCallback, useEffect, useState, useTransition } from 'react'
|
import { useCallback, useEffect, useState, useTransition } from 'react'
|
||||||
|
import { useNoteRefreshOptional } from '@/context/NoteRefreshContext'
|
||||||
import {
|
import {
|
||||||
DndContext,
|
DndContext,
|
||||||
type DragEndEvent,
|
type DragEndEvent,
|
||||||
@@ -266,6 +267,7 @@ function SortableNoteListItem({
|
|||||||
|
|
||||||
export function NotesTabsView({ notes, onEdit, currentNotebookId }: NotesTabsViewProps) {
|
export function NotesTabsView({ notes, onEdit, currentNotebookId }: NotesTabsViewProps) {
|
||||||
const { t, language } = useLanguage()
|
const { t, language } = useLanguage()
|
||||||
|
const { triggerRefresh } = useNoteRefreshOptional()
|
||||||
const [items, setItems] = useState<Note[]>(notes)
|
const [items, setItems] = useState<Note[]>(notes)
|
||||||
const [selectedId, setSelectedId] = useState<string | null>(null)
|
const [selectedId, setSelectedId] = useState<string | null>(null)
|
||||||
const [isCreating, startCreating] = useTransition()
|
const [isCreating, startCreating] = useTransition()
|
||||||
@@ -496,6 +498,7 @@ export function NotesTabsView({ notes, onEdit, currentNotebookId }: NotesTabsVie
|
|||||||
setItems((prev) => prev.filter((n) => n.id !== noteToDelete.id))
|
setItems((prev) => prev.filter((n) => n.id !== noteToDelete.id))
|
||||||
setSelectedId((prev) => (prev === noteToDelete.id ? null : prev))
|
setSelectedId((prev) => (prev === noteToDelete.id ? null : prev))
|
||||||
setNoteToDelete(null)
|
setNoteToDelete(null)
|
||||||
|
triggerRefresh()
|
||||||
toast.success(t('notes.deleted'))
|
toast.success(t('notes.deleted'))
|
||||||
} catch {
|
} catch {
|
||||||
toast.error(t('notes.deleteFailed'))
|
toast.error(t('notes.deleteFailed'))
|
||||||
|
|||||||
Reference in New Issue
Block a user