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 +1 -1
- package/templates/none-js/client/index.js +9 -14
- package/templates/none-js/package.json +2 -3
- package/templates/none-js/src/js/routes/utils.js +15 -3
- package/templates/redux-js/client/index.js +12 -17
- package/templates/redux-js/package.json +2 -3
- package/templates/redux-js/src/js/routes/utils.js +15 -3
- package/templates/rtk-js/client/index.js +12 -17
- package/templates/rtk-js/package.json +2 -3
- package/templates/rtk-js/src/js/routes/utils.js +15 -3
package/package.json
CHANGED
|
@@ -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
|
-
|
|
9
|
-
loadableReady(() => {
|
|
10
|
-
const { __ROUTER_INITIAL_DATA__: routerInitialData } = window
|
|
7
|
+
const { __ROUTER_INITIAL_DATA__: routerInitialData } = window
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
const router = clientRouter({ routerInitialState: routerInitialData })
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
const Application = (
|
|
12
|
+
<React.StrictMode>
|
|
13
|
+
<RouterProvider router={router} />
|
|
14
|
+
</React.StrictMode>
|
|
15
|
+
)
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
"@
|
|
22
|
-
"
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
11
|
-
|
|
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
|
-
|
|
12
|
+
const router = clientRouter({ store, routerInitialState: routerInitialData })
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
26
|
-
|
|
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
|
-
"@
|
|
23
|
-
"
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
11
|
-
|
|
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
|
-
|
|
12
|
+
const router = clientRouter({ store, routerInitialState: routerInitialData })
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
26
|
-
|
|
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
|
-
"@
|
|
23
|
-
"
|
|
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
|
-
|
|
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:
|
|
30
|
+
element: element,
|
|
19
31
|
}
|
|
20
32
|
if (route.children) {
|
|
21
33
|
routeToRender.children = getPreparedRoutes(route.children)
|