fix: move useEffect after loadNotebooks declaration (TS error)
Some checks failed
Deploy to Production / Build and Deploy (push) Failing after 22s
Some checks failed
Deploy to Production / Build and Deploy (push) Failing after 22s
Made-with: Cursor
This commit is contained in:
@@ -86,11 +86,6 @@ export function NotebooksProvider({ children, initialNotebooks = [] }: Notebooks
|
|||||||
const [error, setError] = useState<string | null>(null)
|
const [error, setError] = useState<string | null>(null)
|
||||||
const { triggerRefresh, refreshKey } = useNoteRefresh()
|
const { triggerRefresh, refreshKey } = useNoteRefresh()
|
||||||
|
|
||||||
// Recharge les carnets à chaque fois qu'une note est modifiée/supprimée
|
|
||||||
useEffect(() => {
|
|
||||||
if (refreshKey > 0) loadNotebooks()
|
|
||||||
}, [refreshKey, loadNotebooks])
|
|
||||||
|
|
||||||
// ===== DERIVED STATE =====
|
// ===== DERIVED STATE =====
|
||||||
const currentLabels = useMemo(() => {
|
const currentLabels = useMemo(() => {
|
||||||
if (!currentNotebook) return []
|
if (!currentNotebook) return []
|
||||||
@@ -120,6 +115,11 @@ export function NotebooksProvider({ children, initialNotebooks = [] }: Notebooks
|
|||||||
loadNotebooks()
|
loadNotebooks()
|
||||||
}, [loadNotebooks])
|
}, [loadNotebooks])
|
||||||
|
|
||||||
|
// Recharge les carnets à chaque fois qu'une note est modifiée/supprimée
|
||||||
|
useEffect(() => {
|
||||||
|
if (refreshKey > 0) loadNotebooks()
|
||||||
|
}, [refreshKey, loadNotebooks])
|
||||||
|
|
||||||
// ===== ACTIONS: NOTEBOOKS =====
|
// ===== ACTIONS: NOTEBOOKS =====
|
||||||
const createNotebookOptimistic = useCallback(async (data: CreateNotebookInput) => {
|
const createNotebookOptimistic = useCallback(async (data: CreateNotebookInput) => {
|
||||||
const response = await fetch('/api/notebooks', {
|
const response = await fetch('/api/notebooks', {
|
||||||
|
|||||||
Reference in New Issue
Block a user