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 Dialog from '@mui/material/Dialog'
|
||||||
import DialogTitle from '@mui/material/DialogTitle'
|
import DialogTitle from '@mui/material/DialogTitle'
|
||||||
import DialogContent from '@mui/material/DialogContent'
|
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 [files, setFiles] = useState<GeneratedFiles | null>(null)
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!open) setFiles(null)
|
||||||
|
}, [open])
|
||||||
|
|
||||||
const handleOpen = async () => {
|
const handleOpen = async () => {
|
||||||
if (files) return
|
if (files) return
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
|
|||||||
Reference in New Issue
Block a user