@applica-software-guru/react-admin 1.5.314 → 1.5.315

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -107,5 +107,5 @@
107
107
  "type": "module",
108
108
  "types": "dist/index.d.ts",
109
109
  "typings": "dist/index.d.ts",
110
- "version": "1.5.314"
110
+ "version": "1.5.315"
111
111
  }
@@ -6,6 +6,7 @@ import { Dialog, useMediaQuery, useTheme } from '@mui/material';
6
6
  import _ from 'lodash';
7
7
  import { UseGetIdentityResult, useAuthProvider, useGetIdentity } from 'ra-core';
8
8
  import { createContext, forwardRef, useCallback, useContext, useEffect, useMemo, useReducer, useState } from 'react';
9
+ import { useLoading } from 'react-admin';
9
10
 
10
11
  enum LayoutActionType {
11
12
  UPDATE_MEDIA = 'updateMedia',
@@ -154,6 +155,7 @@ function LayoutProvider(props: ILayoutProviderProps) {
154
155
  const handlePasswordChange = useCallback(() => setNeedToChangePassword(false), []);
155
156
  const value = useMemo(() => ({ state, dispatch }), [state, dispatch]);
156
157
  const { logoIcon, logoMain, enableNotification, notification } = props;
158
+ const isLayoutLoading = useLoading();
157
159
 
158
160
  useEffect(() => {
159
161
  dispatch({
@@ -216,6 +218,7 @@ function LayoutProvider(props: ILayoutProviderProps) {
216
218
  }, [theme.palette.mode]);
217
219
 
218
220
  useEffect(() => {
221
+ if (isLayoutLoading) return;
219
222
  // Check if authProvider contains a method called isImpersonating
220
223
  if (!authProvider.isImpersonating) {
221
224
  // eslint-disable-next-line no-console
@@ -225,7 +228,7 @@ function LayoutProvider(props: ILayoutProviderProps) {
225
228
  authProvider?.isImpersonating().then((isImpersonating: boolean) => {
226
229
  setNeedToChangePassword(!isImpersonating && identity?.data?.needToChangePassword === true);
227
230
  });
228
- }, [identity?.data?.needToChangePassword, authProvider]);
231
+ }, [identity?.data?.needToChangePassword, authProvider, isLayoutLoading]);
229
232
 
230
233
  return (
231
234
  <LayoutContext.Provider value={value}>