repair: sollution brand-device
This commit is contained in:
@@ -95,11 +95,18 @@ const AddBrandDevice = () => {
|
||||
name: '',
|
||||
type: 'text',
|
||||
text: '',
|
||||
status: true
|
||||
status: true,
|
||||
fileUpload: null,
|
||||
file: null,
|
||||
path_solution: null,
|
||||
fileName: null
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
setSolutionFields([0]);
|
||||
setSolutionTypes({ 0: 'text' });
|
||||
setSolutionStatuses({ 0: true });
|
||||
setCurrentSolutionData([]);
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user