create-catalyst-app-internal 0.0.1-beta.39 → 0.0.1-beta.40
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/common/server/document.js +1 -1
- package/templates/none-js/client/index.js +15 -10
- package/templates/none-js/package.json +3 -2
- package/templates/none-js/src/js/routes/utils.js +3 -15
- package/templates/redux-js/client/index.js +18 -13
- package/templates/redux-js/package.json +3 -2
- package/templates/redux-js/src/js/routes/utils.js +3 -15
- package/templates/rtk-js/client/index.js +18 -13
- package/templates/rtk-js/package.json +3 -2
- package/templates/rtk-js/src/js/routes/utils.js +3 -15
package/package.json
CHANGED
|
@@ -1,18 +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"
|
|
4
5
|
import { RouterProvider } from "@tata1mg/router"
|
|
5
|
-
import clientRouter from "catalyst-core
|
|
6
|
+
import clientRouter from "catalyst-core/router/ClientRouter"
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
window.addEventListener("load", () => {
|
|
9
|
+
loadableReady(() => {
|
|
10
|
+
const { __ROUTER_INITIAL_DATA__: routerInitialData } = window
|
|
8
11
|
|
|
9
|
-
const router = clientRouter({ routerInitialState: routerInitialData })
|
|
12
|
+
const router = clientRouter({ routerInitialState: routerInitialData })
|
|
10
13
|
|
|
11
|
-
const Application = (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
)
|
|
14
|
+
const Application = (
|
|
15
|
+
<React.StrictMode>
|
|
16
|
+
<RouterProvider router={router} />
|
|
17
|
+
</React.StrictMode>
|
|
18
|
+
)
|
|
16
19
|
|
|
17
|
-
const container = document.getElementById("app")
|
|
18
|
-
hydrateRoot(container, Application)
|
|
20
|
+
const container = document.getElementById("app")
|
|
21
|
+
hydrateRoot(container, Application)
|
|
22
|
+
})
|
|
23
|
+
})
|
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
"@routes": "src/js/routes/"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@
|
|
22
|
-
"
|
|
21
|
+
"@loadable/component": "^5.16.3",
|
|
22
|
+
"@tata1mg/router": "^0.0.1-beta.3",
|
|
23
|
+
"catalyst-core-internal": "0.0.1-beta.30"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"eslint": "^8.26.0",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React 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,22 +12,10 @@ import routes from "./index.js"
|
|
|
12
12
|
export const preparedRoutes = ({ routerInitialState }) => {
|
|
13
13
|
const getPreparedRoutes = (routes) => {
|
|
14
14
|
return routes.map((route, index) => {
|
|
15
|
-
|
|
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
|
-
|
|
15
|
+
const Component = route.component
|
|
28
16
|
const routeToRender = {
|
|
29
17
|
...route,
|
|
30
|
-
element:
|
|
18
|
+
element: <Component key={index} />,
|
|
31
19
|
}
|
|
32
20
|
if (route.children) {
|
|
33
21
|
routeToRender.children = getPreparedRoutes(route.children)
|
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import "./styles"
|
|
3
3
|
import { hydrateRoot } from "react-dom/client"
|
|
4
|
+
import { loadableReady } from "@loadable/component"
|
|
4
5
|
import { Provider } from "react-redux"
|
|
5
6
|
import { RouterProvider } from "@tata1mg/router"
|
|
6
|
-
import clientRouter from "catalyst-core
|
|
7
|
+
import clientRouter from "catalyst-core/router/ClientRouter"
|
|
7
8
|
import configureStore from "@store"
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
window.addEventListener("load", () => {
|
|
11
|
+
loadableReady(() => {
|
|
12
|
+
const { __ROUTER_INITIAL_DATA__: routerInitialData, __INITIAL_STATE__ } = window
|
|
13
|
+
const store = configureStore(__INITIAL_STATE__ || {})
|
|
11
14
|
|
|
12
|
-
const router = clientRouter({ store, routerInitialState: routerInitialData })
|
|
15
|
+
const router = clientRouter({ store, routerInitialState: routerInitialData })
|
|
13
16
|
|
|
14
|
-
const Application = (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
)
|
|
17
|
+
const Application = (
|
|
18
|
+
<Provider store={store} serverState={__INITIAL_STATE__}>
|
|
19
|
+
<React.StrictMode>
|
|
20
|
+
<RouterProvider router={router} />
|
|
21
|
+
</React.StrictMode>
|
|
22
|
+
</Provider>
|
|
23
|
+
)
|
|
21
24
|
|
|
22
|
-
const container = document.getElementById("app")
|
|
23
|
-
hydrateRoot(container, Application)
|
|
25
|
+
const container = document.getElementById("app")
|
|
26
|
+
hydrateRoot(container, Application)
|
|
27
|
+
})
|
|
28
|
+
})
|
|
@@ -19,8 +19,9 @@
|
|
|
19
19
|
"@store": "src/js/store/index.js"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@
|
|
23
|
-
"
|
|
22
|
+
"@loadable/component": "^5.16.3",
|
|
23
|
+
"@tata1mg/router": "^0.0.1-beta.3",
|
|
24
|
+
"catalyst-core-internal": "0.0.1-beta.30",
|
|
24
25
|
"@reduxjs/toolkit": "1.9.3",
|
|
25
26
|
"react-redux": "^8.1.3"
|
|
26
27
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React 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,22 +12,10 @@ 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
|
-
|
|
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
|
-
|
|
15
|
+
const Component = route.component
|
|
28
16
|
const routeToRender = {
|
|
29
17
|
...route,
|
|
30
|
-
element:
|
|
18
|
+
element: <Component key={index} />,
|
|
31
19
|
}
|
|
32
20
|
if (route.children) {
|
|
33
21
|
routeToRender.children = getPreparedRoutes(route.children)
|
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import "./styles"
|
|
3
3
|
import { hydrateRoot } from "react-dom/client"
|
|
4
|
+
import { loadableReady } from "@loadable/component"
|
|
4
5
|
import { Provider } from "react-redux"
|
|
5
6
|
import { RouterProvider } from "@tata1mg/router"
|
|
6
|
-
import clientRouter from "catalyst-core
|
|
7
|
+
import clientRouter from "catalyst-core/router/ClientRouter"
|
|
7
8
|
import configureStore from "@store"
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
window.addEventListener("load", () => {
|
|
11
|
+
loadableReady(() => {
|
|
12
|
+
const { __ROUTER_INITIAL_DATA__: routerInitialData, __INITIAL_STATE__ } = window
|
|
13
|
+
const store = configureStore(__INITIAL_STATE__ || {})
|
|
11
14
|
|
|
12
|
-
const router = clientRouter({ store, routerInitialState: routerInitialData })
|
|
15
|
+
const router = clientRouter({ store, routerInitialState: routerInitialData })
|
|
13
16
|
|
|
14
|
-
const Application = (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
)
|
|
17
|
+
const Application = (
|
|
18
|
+
<Provider store={store} serverState={__INITIAL_STATE__}>
|
|
19
|
+
<React.StrictMode>
|
|
20
|
+
<RouterProvider router={router} />
|
|
21
|
+
</React.StrictMode>
|
|
22
|
+
</Provider>
|
|
23
|
+
)
|
|
21
24
|
|
|
22
|
-
const container = document.getElementById("app")
|
|
23
|
-
hydrateRoot(container, Application)
|
|
25
|
+
const container = document.getElementById("app")
|
|
26
|
+
hydrateRoot(container, Application)
|
|
27
|
+
})
|
|
28
|
+
})
|
|
@@ -19,8 +19,9 @@
|
|
|
19
19
|
"@store": "src/js/store/index.js"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@
|
|
23
|
-
"
|
|
22
|
+
"@loadable/component": "^5.16.3",
|
|
23
|
+
"@tata1mg/router": "^0.0.1-beta.3",
|
|
24
|
+
"catalyst-core-internal": "0.0.1-beta.30",
|
|
24
25
|
"@reduxjs/toolkit": "1.9.3",
|
|
25
26
|
"react-redux": "^8.1.3"
|
|
26
27
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React 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,22 +12,10 @@ 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
|
-
|
|
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
|
-
|
|
15
|
+
const Component = route.component
|
|
28
16
|
const routeToRender = {
|
|
29
17
|
...route,
|
|
30
|
-
element:
|
|
18
|
+
element: <Component key={index} />,
|
|
31
19
|
}
|
|
32
20
|
if (route.children) {
|
|
33
21
|
routeToRender.children = getPreparedRoutes(route.children)
|