fix: removed setState within an effect, responsibility moved to parent key

This commit is contained in:
findthelorax
2026-04-20 00:13:07 -04:00
parent 9dddd00858
commit f6de7d1770
3 changed files with 5 additions and 12 deletions
+1 -9
View File
@@ -1,4 +1,4 @@
import { createElement, useEffect, useState } from 'react'
import { createElement, useState } from 'react'
import { RotateCcw, ChevronDown } from 'lucide-react'
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog'
import { Button } from '@/components/ui/button'
@@ -48,14 +48,6 @@ export function NodeModal({ open, onClose, onSubmit, initial, title = 'Add Node'
const [iconPickerOpen, setIconPickerOpen] = useState(false)
const [labelError, setLabelError] = useState(false)
useEffect(() => {
if (!open) return
setForm({ ...DEFAULT_DATA, ...initial })
setIconSearch('')
setIconPickerOpen(false)
setLabelError(false)
}, [open, initial])
const set = (key: keyof NodeData, value: unknown) =>
setForm((f) => ({ ...f, [key]: value }))