mirror of
https://github.com/strapi/strapi.git
synced 2025-08-10 01:38:10 +00:00
Merge pull request #5683 from strapi/fix/toggle-refetch
Fix refetch files on toggle
This commit is contained in:
commit
96b2bc7921
@ -24,6 +24,7 @@ const ModalStepper = ({
|
||||
const [shouldDeleteFile, setShouldDeleteFile] = useState(false);
|
||||
const [isFormDisabled, setIsFormDisabled] = useState(false);
|
||||
const [formErrors, setFormErrors] = useState(null);
|
||||
const [shouldRefetch, setShouldRefetch] = useState(false);
|
||||
const [displayNextButton, setDisplayNextButton] = useState(false);
|
||||
const [reducerState, dispatch] = useReducer(reducer, initialState, init);
|
||||
const { currentStep, fileToEdit, filesToDownload, filesToUpload } = reducerState.toJS();
|
||||
@ -213,6 +214,7 @@ const ModalStepper = ({
|
||||
setIsFormDisabled(false);
|
||||
setDisplayNextButton(false);
|
||||
setFormErrors(null);
|
||||
setShouldRefetch(false);
|
||||
|
||||
dispatch({
|
||||
type: 'RESET_PROPS',
|
||||
@ -333,7 +335,7 @@ const ModalStepper = ({
|
||||
}
|
||||
}
|
||||
|
||||
onToggle(true);
|
||||
onToggle(shouldRefetch);
|
||||
};
|
||||
|
||||
const handleUploadFiles = async () => {
|
||||
@ -361,6 +363,8 @@ const ModalStepper = ({
|
||||
false
|
||||
);
|
||||
|
||||
setShouldRefetch(true);
|
||||
|
||||
dispatch({
|
||||
type: 'REMOVE_FILE_TO_UPLOAD',
|
||||
fileIndex: originalIndex,
|
||||
|
Loading…
x
Reference in New Issue
Block a user