mirror of
https://github.com/strapi/strapi.git
synced 2025-08-11 10:18:28 +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 [shouldDeleteFile, setShouldDeleteFile] = useState(false);
|
||||||
const [isFormDisabled, setIsFormDisabled] = useState(false);
|
const [isFormDisabled, setIsFormDisabled] = useState(false);
|
||||||
const [formErrors, setFormErrors] = useState(null);
|
const [formErrors, setFormErrors] = useState(null);
|
||||||
|
const [shouldRefetch, setShouldRefetch] = useState(false);
|
||||||
const [displayNextButton, setDisplayNextButton] = useState(false);
|
const [displayNextButton, setDisplayNextButton] = useState(false);
|
||||||
const [reducerState, dispatch] = useReducer(reducer, initialState, init);
|
const [reducerState, dispatch] = useReducer(reducer, initialState, init);
|
||||||
const { currentStep, fileToEdit, filesToDownload, filesToUpload } = reducerState.toJS();
|
const { currentStep, fileToEdit, filesToDownload, filesToUpload } = reducerState.toJS();
|
||||||
@ -213,6 +214,7 @@ const ModalStepper = ({
|
|||||||
setIsFormDisabled(false);
|
setIsFormDisabled(false);
|
||||||
setDisplayNextButton(false);
|
setDisplayNextButton(false);
|
||||||
setFormErrors(null);
|
setFormErrors(null);
|
||||||
|
setShouldRefetch(false);
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'RESET_PROPS',
|
type: 'RESET_PROPS',
|
||||||
@ -333,7 +335,7 @@ const ModalStepper = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onToggle(true);
|
onToggle(shouldRefetch);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleUploadFiles = async () => {
|
const handleUploadFiles = async () => {
|
||||||
@ -361,6 +363,8 @@ const ModalStepper = ({
|
|||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
setShouldRefetch(true);
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'REMOVE_FILE_TO_UPLOAD',
|
type: 'REMOVE_FILE_TO_UPLOAD',
|
||||||
fileIndex: originalIndex,
|
fileIndex: originalIndex,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user