@asaleh37/ui-base 25.8.1-5.3 → 25.8.1-5.6

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asaleh37/ui-base",
3
- "version": "25.8.15.3",
3
+ "version": "25.8.15.6",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "Ahmed Saleh Mohamed",
@@ -18,16 +18,28 @@ import i18n from "../locales/i18n";
18
18
  import { initReactI18next } from "react-i18next";
19
19
  import { ENGLISH_TRANS } from "../locales/english";
20
20
  import { ARABIC_TRANS } from "../locales/arabic";
21
- import { useEffect } from "react";
21
+ import { useEffect, useState } from "react";
22
22
 
23
23
  library.add(fab);
24
24
  library.add(far);
25
25
  library.add(fas);
26
26
 
27
27
  export const BaseApp: React.FC<AppInfo> = (props) => {
28
- let store = configureStore({ reducer: {} });
28
+ // let store = null;
29
+ const [systemReducers, setSystemReducers] = useState<any>({
30
+ AppLayout: AppLayoutReducer,
31
+ UserSession: UserSessionReducer,
32
+ loadingMask: LoadingMaskReducer,
33
+ commonStores: CommonStoreReducer,
34
+ SideBar: SideBarReducer,
35
+ AppInfo: AppInfoReducer,
36
+ });
37
+ const store = configureStore({
38
+ reducer: systemReducers,
39
+ });
40
+ const [isAppInitialized, setIsAppInitialized] = useState<boolean>(false);
29
41
  const initializeApp = () => {
30
- const systemReducers = {
42
+ const reducers = {
31
43
  AppLayout: AppLayoutReducer,
32
44
  UserSession: UserSessionReducer,
33
45
  loadingMask: LoadingMaskReducer,
@@ -36,8 +48,8 @@ export const BaseApp: React.FC<AppInfo> = (props) => {
36
48
  AppInfo: AppInfoReducer,
37
49
  ...props?.businessReduxReducers,
38
50
  };
39
- store = configureStore({
40
- reducer: systemReducers,
51
+ setSystemReducers((state) => {
52
+ return { ...reducers };
41
53
  });
42
54
  const resources = {
43
55
  en: { translation: { ...ENGLISH_TRANS, ...props?.businessLocals?.en } },
@@ -48,13 +60,16 @@ export const BaseApp: React.FC<AppInfo> = (props) => {
48
60
  lng: localStorage.getItem("language") || "en", // Set the initial language of the App
49
61
  fallbackLng: "en",
50
62
  });
63
+ setIsAppInitialized(true);
51
64
  };
52
65
  useEffect(() => {
53
66
  initializeApp();
54
67
  }, [props]);
55
- return (
68
+ return isAppInitialized ? (
56
69
  <Provider store={store}>
57
70
  <App {...props} />
58
71
  </Provider>
72
+ ) : (
73
+ <></>
59
74
  );
60
75
  };