Skip to content

Commit

Permalink
Merge pull request #7044 from marmelab/fix-progress-indicator
Browse files Browse the repository at this point in the history
Fix loading indicator not updated on permissions error when logoutUser is false
  • Loading branch information
fzaninotto authored Jan 3, 2022
2 parents 850b859 + 2b18d08 commit c71cd3e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/ra-core/src/auth/useLogoutIfAccessDenied.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const useLogoutIfAccessDenied = (): LogoutIfAccessDenied => {
const logout = useLogout();
const notify = useNotify();
const history = useHistory();

const logoutIfAccessDenied = useCallback(
(error?: any, disableNotification?: boolean) =>
authProvider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ export const performOptimisticQuery = ({
console.error(error);
}
return logoutIfAccessDenied(error).then(loggedOut => {
if (loggedOut) return;
if (loggedOut) {
dispatch({ type: FETCH_END });
return;
}
dispatch({
type: `${action}_FAILURE`,
error: error.message ? error.message : error,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ export const performPessimisticQuery = ({
console.error(error);
}
return logoutIfAccessDenied(error).then(loggedOut => {
if (loggedOut) return;
if (loggedOut) {
dispatch({ type: FETCH_END });
return;
}
dispatch({
type: `${action}_FAILURE`,
error: error.message ? error.message : error,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ export const performUndoableQuery = ({
console.error(error);
}
return logoutIfAccessDenied(error).then(loggedOut => {
if (loggedOut) return;
if (loggedOut) {
dispatch({ type: FETCH_END });
return;
}
dispatch({
type: `${action}_FAILURE`,
error: error.message ? error.message : error,
Expand Down

0 comments on commit c71cd3e

Please sign in to comment.