fix: reset generated files cache when modal closes so reopening fetches fresh data
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useState } from 'react'
|
||||
import { useState, useEffect } from 'react'
|
||||
import Dialog from '@mui/material/Dialog'
|
||||
import DialogTitle from '@mui/material/DialogTitle'
|
||||
import DialogContent from '@mui/material/DialogContent'
|
||||
@@ -37,6 +37,10 @@ export default function GenerateModal({ open, configId, configName, onClose }: P
|
||||
const [files, setFiles] = useState<GeneratedFiles | null>(null)
|
||||
const [loading, setLoading] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) setFiles(null)
|
||||
}, [open])
|
||||
|
||||
const handleOpen = async () => {
|
||||
if (files) return
|
||||
setLoading(true)
|
||||
|
||||
Reference in New Issue
Block a user