@modern-js/utils 2.8.1-alpha.0 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +2 -0
- package/dist/nestedRoutes.js +4 -6
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
package/dist/nestedRoutes.js
CHANGED
@@ -50,7 +50,7 @@ const transformNestedRoutes = (routes) => {
|
|
50
50
|
return (0, import_react_router_dom.createRoutesFromElements)(routeElements);
|
51
51
|
};
|
52
52
|
const renderNestedRoute = (nestedRoute, options = {}) => {
|
53
|
-
const { children, index, id, component, isRoot
|
53
|
+
const { children, index, id, component, isRoot } = nestedRoute;
|
54
54
|
const Component = component;
|
55
55
|
const { parent, DeferredDataComponent } = options;
|
56
56
|
const routeProps = {
|
@@ -72,24 +72,22 @@ const renderNestedRoute = (nestedRoute, options = {}) => {
|
|
72
72
|
}
|
73
73
|
let element;
|
74
74
|
if (Component) {
|
75
|
-
if (
|
75
|
+
if (parent == null ? void 0 : parent.loading) {
|
76
76
|
const Loading = parent.loading;
|
77
77
|
if (isLoadableComponent(Component)) {
|
78
78
|
element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loading, {}) });
|
79
79
|
} else {
|
80
80
|
element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loading, {}), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}) });
|
81
81
|
}
|
82
|
-
} else if (isLoadableComponent(Component)
|
82
|
+
} else if (isLoadableComponent(Component)) {
|
83
83
|
element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {});
|
84
84
|
} else if (isRoot) {
|
85
85
|
element = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
86
86
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}),
|
87
87
|
typeof document === "undefined" && DeferredDataComponent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DeferredDataComponent, {})
|
88
88
|
] });
|
89
|
-
} else if (lazyImport) {
|
90
|
-
element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}) });
|
91
89
|
} else {
|
92
|
-
element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {});
|
90
|
+
element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}) });
|
93
91
|
}
|
94
92
|
} else {
|
95
93
|
nestedRoute.loading = parent == null ? void 0 : parent.loading;
|
package/package.json
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "2.
|
14
|
+
"version": "2.9.0",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/index.d.ts",
|
17
17
|
"main": "./dist/index.js",
|
@@ -167,9 +167,9 @@
|
|
167
167
|
"typescript": "^4",
|
168
168
|
"webpack": "^5.75.0",
|
169
169
|
"@types/serialize-javascript": "^5.0.1",
|
170
|
-
"@modern-js/types": "2.
|
171
|
-
"@scripts/
|
172
|
-
"@scripts/
|
170
|
+
"@modern-js/types": "2.9.0",
|
171
|
+
"@scripts/jest-config": "2.9.0",
|
172
|
+
"@scripts/build": "2.9.0"
|
173
173
|
},
|
174
174
|
"sideEffects": false,
|
175
175
|
"scripts": {
|