create-catalyst-app-internal 0.0.1-beta.38 → 0.0.1-beta.39

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,7 +1,7 @@
1
1
  {
2
2
  "name": "create-catalyst-app-internal",
3
3
  "bin": "scripts/cli.cjs",
4
- "version": "0.0.1-beta.38",
4
+ "version": "0.0.1-beta.39",
5
5
  "description": "cli package to scaffold Catalyst application",
6
6
  "dependencies": {
7
7
  "commander": "^8.2.0",
@@ -1,23 +1,18 @@
1
1
  import React from "react"
2
2
  import "./styles"
3
3
  import { hydrateRoot } from "react-dom/client"
4
- import { loadableReady } from "@loadable/component"
5
4
  import { RouterProvider } from "@tata1mg/router"
6
5
  import clientRouter from "catalyst-core-internal/router/ClientRouter"
7
6
 
8
- window.addEventListener("load", () => {
9
- loadableReady(() => {
10
- const { __ROUTER_INITIAL_DATA__: routerInitialData } = window
7
+ const { __ROUTER_INITIAL_DATA__: routerInitialData } = window
11
8
 
12
- const router = clientRouter({ routerInitialState: routerInitialData })
9
+ const router = clientRouter({ routerInitialState: routerInitialData })
13
10
 
14
- const Application = (
15
- <React.StrictMode>
16
- <RouterProvider router={router} />
17
- </React.StrictMode>
18
- )
11
+ const Application = (
12
+ <React.StrictMode>
13
+ <RouterProvider router={router} />
14
+ </React.StrictMode>
15
+ )
19
16
 
20
- const container = document.getElementById("app")
21
- hydrateRoot(container, Application)
22
- })
23
- })
17
+ const container = document.getElementById("app")
18
+ hydrateRoot(container, Application)
@@ -18,9 +18,8 @@
18
18
  "@routes": "src/js/routes/"
19
19
  },
20
20
  "dependencies": {
21
- "@loadable/component": "^5.16.3",
22
- "@tata1mg/router": "^0.0.1-beta.2",
23
- "catalyst-core-internal": "^0.0.1-beta.24"
21
+ "@tata1mg/router": "0.0.1-beta.3",
22
+ "catalyst-core-internal": "^0.0.1-beta.25"
24
23
  },
25
24
  "devDependencies": {
26
25
  "eslint": "^8.26.0",
@@ -1,4 +1,4 @@
1
- import React from "react"
1
+ import React, { Suspense } from "react"
2
2
  import { RouterDataProvider, MetaTag } from "@tata1mg/router"
3
3
  import App from "@containers/App"
4
4
  import routes from "./index.js"
@@ -12,10 +12,22 @@ import routes from "./index.js"
12
12
  export const preparedRoutes = ({ routerInitialState }) => {
13
13
  const getPreparedRoutes = (routes) => {
14
14
  return routes.map((route, index) => {
15
- const Component = route.component
15
+ let element = null;
16
+ const Component = route.component;
17
+
18
+ if (typeof Component === "object" && route.fallback) {
19
+ element = (
20
+ <Suspense fallback={route.fallback}>
21
+ <Component key={index} />
22
+ </Suspense>
23
+ );
24
+ } else {
25
+ element = <Component key={index} />;
26
+ }
27
+
16
28
  const routeToRender = {
17
29
  ...route,
18
- element: <Component key={index} />,
30
+ element: element,
19
31
  }
20
32
  if (route.children) {
21
33
  routeToRender.children = getPreparedRoutes(route.children)
@@ -1,28 +1,23 @@
1
1
  import React from "react"
2
2
  import "./styles"
3
3
  import { hydrateRoot } from "react-dom/client"
4
- import { loadableReady } from "@loadable/component"
5
4
  import { Provider } from "react-redux"
6
5
  import { RouterProvider } from "@tata1mg/router"
7
6
  import clientRouter from "catalyst-core-internal/router/ClientRouter"
8
7
  import configureStore from "@store"
9
8
 
10
- window.addEventListener("load", () => {
11
- loadableReady(() => {
12
- const { __ROUTER_INITIAL_DATA__: routerInitialData, __INITIAL_STATE__ } = window
13
- const store = configureStore(__INITIAL_STATE__ || {})
9
+ const { __ROUTER_INITIAL_DATA__: routerInitialData, __INITIAL_STATE__ } = window
10
+ const store = configureStore(__INITIAL_STATE__ || {})
14
11
 
15
- const router = clientRouter({ store, routerInitialState: routerInitialData })
12
+ const router = clientRouter({ store, routerInitialState: routerInitialData })
16
13
 
17
- const Application = (
18
- <Provider store={store} serverState={__INITIAL_STATE__}>
19
- <React.StrictMode>
20
- <RouterProvider router={router} />
21
- </React.StrictMode>
22
- </Provider>
23
- )
14
+ const Application = (
15
+ <Provider store={store} serverState={__INITIAL_STATE__}>
16
+ <React.StrictMode>
17
+ <RouterProvider router={router} />
18
+ </React.StrictMode>
19
+ </Provider>
20
+ )
24
21
 
25
- const container = document.getElementById("app")
26
- hydrateRoot(container, Application)
27
- })
28
- })
22
+ const container = document.getElementById("app")
23
+ hydrateRoot(container, Application)
@@ -19,9 +19,8 @@
19
19
  "@store": "src/js/store/index.js"
20
20
  },
21
21
  "dependencies": {
22
- "@loadable/component": "^5.16.3",
23
- "@tata1mg/router": "^0.0.1-beta.2",
24
- "catalyst-core-internal": "^0.0.1-beta.24",
22
+ "@tata1mg/router": "0.0.1-beta.3",
23
+ "catalyst-core-internal": "^0.0.1-beta.25",
25
24
  "@reduxjs/toolkit": "1.9.3",
26
25
  "react-redux": "^8.1.3"
27
26
  },
@@ -1,4 +1,4 @@
1
- import React from "react"
1
+ import React, { Suspense } from "react"
2
2
  import { RouterDataProvider, MetaTag } from "@tata1mg/router"
3
3
  import App from "@containers/App"
4
4
  import routes from "./index.js"
@@ -12,10 +12,22 @@ import routes from "./index.js"
12
12
  export const preparedRoutes = ({ store, routerInitialState }) => {
13
13
  const getPreparedRoutes = (routes) => {
14
14
  return routes.map((route, index) => {
15
- const Component = route.component
15
+ let element = null;
16
+ const Component = route.component;
17
+
18
+ if (typeof Component === "object" && route.fallback) {
19
+ element = (
20
+ <Suspense fallback={route.fallback}>
21
+ <Component key={index} />
22
+ </Suspense>
23
+ );
24
+ } else {
25
+ element = <Component key={index} />;
26
+ }
27
+
16
28
  const routeToRender = {
17
29
  ...route,
18
- element: <Component key={index} />,
30
+ element: element,
19
31
  }
20
32
  if (route.children) {
21
33
  routeToRender.children = getPreparedRoutes(route.children)
@@ -1,28 +1,23 @@
1
1
  import React from "react"
2
2
  import "./styles"
3
3
  import { hydrateRoot } from "react-dom/client"
4
- import { loadableReady } from "@loadable/component"
5
4
  import { Provider } from "react-redux"
6
5
  import { RouterProvider } from "@tata1mg/router"
7
6
  import clientRouter from "catalyst-core-internal/router/ClientRouter"
8
7
  import configureStore from "@store"
9
8
 
10
- window.addEventListener("load", () => {
11
- loadableReady(() => {
12
- const { __ROUTER_INITIAL_DATA__: routerInitialData, __INITIAL_STATE__ } = window
13
- const store = configureStore(__INITIAL_STATE__ || {})
9
+ const { __ROUTER_INITIAL_DATA__: routerInitialData, __INITIAL_STATE__ } = window
10
+ const store = configureStore(__INITIAL_STATE__ || {})
14
11
 
15
- const router = clientRouter({ store, routerInitialState: routerInitialData })
12
+ const router = clientRouter({ store, routerInitialState: routerInitialData })
16
13
 
17
- const Application = (
18
- <Provider store={store} serverState={__INITIAL_STATE__}>
19
- <React.StrictMode>
20
- <RouterProvider router={router} />
21
- </React.StrictMode>
22
- </Provider>
23
- )
14
+ const Application = (
15
+ <Provider store={store} serverState={__INITIAL_STATE__}>
16
+ <React.StrictMode>
17
+ <RouterProvider router={router} />
18
+ </React.StrictMode>
19
+ </Provider>
20
+ )
24
21
 
25
- const container = document.getElementById("app")
26
- hydrateRoot(container, Application)
27
- })
28
- })
22
+ const container = document.getElementById("app")
23
+ hydrateRoot(container, Application)
@@ -19,9 +19,8 @@
19
19
  "@store": "src/js/store/index.js"
20
20
  },
21
21
  "dependencies": {
22
- "@loadable/component": "^5.16.3",
23
- "@tata1mg/router": "^0.0.1-beta.2",
24
- "catalyst-core-internal": "^0.0.1-beta.24",
22
+ "@tata1mg/router": "0.0.1-beta.3",
23
+ "catalyst-core-internal": "^0.0.1-beta.25",
25
24
  "@reduxjs/toolkit": "1.9.3",
26
25
  "react-redux": "^8.1.3"
27
26
  },
@@ -1,4 +1,4 @@
1
- import React from "react"
1
+ import React, { Suspense } from "react"
2
2
  import { RouterDataProvider, MetaTag } from "@tata1mg/router"
3
3
  import App from "@containers/App"
4
4
  import routes from "./index.js"
@@ -12,10 +12,22 @@ import routes from "./index.js"
12
12
  export const preparedRoutes = ({ store, routerInitialState }) => {
13
13
  const getPreparedRoutes = (routes) => {
14
14
  return routes.map((route, index) => {
15
- const Component = route.component
15
+ let element = null;
16
+ const Component = route.component;
17
+
18
+ if (typeof Component === "object" && route.fallback) {
19
+ element = (
20
+ <Suspense fallback={route.fallback}>
21
+ <Component key={index} />
22
+ </Suspense>
23
+ );
24
+ } else {
25
+ element = <Component key={index} />;
26
+ }
27
+
16
28
  const routeToRender = {
17
29
  ...route,
18
- element: <Component key={index} />,
30
+ element: element,
19
31
  }
20
32
  if (route.children) {
21
33
  routeToRender.children = getPreparedRoutes(route.children)