fix: removed setState within an effect, responsibility moved to parent key
This commit is contained in:
@@ -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 }))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user