repair: sollution brand-device

This commit is contained in:
2025-12-12 15:58:11 +07:00
parent 1f8ee62721
commit 2ff50342e8
2 changed files with 18 additions and 1 deletions

View File

@@ -48,6 +48,16 @@ const SolutionFieldNew = ({
const [deleteCounter, setDeleteCounter] = useState(0);
// Reset internal state when form is reset to initial values
React.useEffect(() => {
// Check if form is in initial/reset state (name is empty)
if (!nameValue || nameValue === '') {
setCurrentFile(null);
setIsDeleted(false);
setDeleteCounter(prev => prev + 1);
}
}, [nameValue]);
React.useEffect(() => {
const getFileFromFormValues = () => {
const hasValidFileUpload = fileUpload && typeof fileUpload === 'object' && Object.keys(fileUpload).length > 0;