reload managers before closing modal

This commit is contained in:
Eric Rosenbaum 2021-08-26 19:49:46 -04:00
parent 65eddfe420
commit a6b7ef3c4b
2 changed files with 4 additions and 3 deletions

View file

@ -45,7 +45,7 @@ const normalizeError = (err, body, res) => {
return null;
};
const loadManagers = (reloadAll = false) => ((dispatch, getState) => {
const loadManagers = (reloadAll = false) => ((dispatch, getState) => new Promise(resolve => {
const state = getState();
const studioId = selectStudioId(state);
const managerCount = reloadAll ? 0 : managers.selector(state).items.length;
@ -58,8 +58,9 @@ const loadManagers = (reloadAll = false) => ((dispatch, getState) => {
if (error) return dispatch(managers.actions.error(error));
if (reloadAll) dispatch(managers.actions.clear());
dispatch(managers.actions.append(body, body.length === PER_PAGE_LIMIT));
return resolve();
});
});
}));
const loadCurators = () => ((dispatch, getState) => {
const state = getState();

View file

@ -47,9 +47,9 @@ const TransferHostConfirmation = ({
const handleSubmit = () => {
setSubmitting(true);
handleTransferHost(passwordInputValue, newHostUsername, selectedId)
.then(() => handleLoadManagers(true)) // reload the list of managers, to get them in the correct order
.then(() => {
handleClose();
handleLoadManagers(true); // reload the list of managers, to get them in the correct order
successAlert({
id: 'studio.alertTransfer',
values: {name: newHostUsername}