@umijs/renderer-react 4.0.13 → 4.0.14
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/dist/browser.js +13 -18
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -7,7 +7,6 @@ import ReactDOM from 'react-dom/client';
|
|
|
7
7
|
import { matchRoutes, Router, useRoutes } from 'react-router-dom';
|
|
8
8
|
import { AppContext, useAppData } from "./appContext";
|
|
9
9
|
import { createClientRoutes } from "./routes";
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
10
|
var root = null; // react 18 some scenarios need unmount such as micro app
|
|
12
11
|
|
|
13
12
|
export function __getRoot() {
|
|
@@ -48,12 +47,11 @@ function BrowserRoutes(props) {
|
|
|
48
47
|
action: state.action
|
|
49
48
|
});
|
|
50
49
|
}, [history, props.routes, props.clientRoutes]);
|
|
51
|
-
return /*#__PURE__*/
|
|
50
|
+
return /*#__PURE__*/React.createElement(Router, {
|
|
52
51
|
navigator: history,
|
|
53
52
|
location: state.location,
|
|
54
|
-
basename: props.basename
|
|
55
|
-
|
|
56
|
-
});
|
|
53
|
+
basename: props.basename
|
|
54
|
+
}, props.children);
|
|
57
55
|
}
|
|
58
56
|
|
|
59
57
|
export function Routes() {
|
|
@@ -77,15 +75,13 @@ export function renderClient(opts) {
|
|
|
77
75
|
routes: clientRoutes
|
|
78
76
|
}
|
|
79
77
|
});
|
|
80
|
-
|
|
81
|
-
var rootContainer = /*#__PURE__*/_jsx(BrowserRoutes, {
|
|
78
|
+
var rootContainer = /*#__PURE__*/React.createElement(BrowserRoutes, {
|
|
82
79
|
basename: basename,
|
|
83
80
|
pluginManager: opts.pluginManager,
|
|
84
81
|
routes: opts.routes,
|
|
85
82
|
clientRoutes: clientRoutes,
|
|
86
|
-
history: opts.history
|
|
87
|
-
|
|
88
|
-
});
|
|
83
|
+
history: opts.history
|
|
84
|
+
}, /*#__PURE__*/React.createElement(Routes, null));
|
|
89
85
|
|
|
90
86
|
for (var _i = 0, _arr = [// Lowest to the highest priority
|
|
91
87
|
'innerProvider', 'i18nProvider', 'accessProvider', 'dataflowProvider', 'outerProvider', 'rootContainer']; _i < _arr.length; _i++) {
|
|
@@ -114,7 +110,7 @@ export function renderClient(opts) {
|
|
|
114
110
|
var _matchRoutes;
|
|
115
111
|
|
|
116
112
|
// Patched routes has to id
|
|
117
|
-
var matchedRouteIds = (((_matchRoutes = matchRoutes(clientRoutes, id)) === null || _matchRoutes === void 0 ? void 0 : _matchRoutes.map( // @ts-ignore
|
|
113
|
+
var matchedRouteIds = (((_matchRoutes = matchRoutes(clientRoutes, id, basename)) === null || _matchRoutes === void 0 ? void 0 : _matchRoutes.map( // @ts-ignore
|
|
118
114
|
function (route) {
|
|
119
115
|
return route.route.id;
|
|
120
116
|
})) || []).filter(Boolean);
|
|
@@ -196,7 +192,7 @@ export function renderClient(opts) {
|
|
|
196
192
|
handleRouteChange(e.location.pathname);
|
|
197
193
|
});
|
|
198
194
|
}, []);
|
|
199
|
-
return /*#__PURE__*/
|
|
195
|
+
return /*#__PURE__*/React.createElement(AppContext.Provider, {
|
|
200
196
|
value: {
|
|
201
197
|
routes: opts.routes,
|
|
202
198
|
routeComponents: opts.routeComponents,
|
|
@@ -207,20 +203,19 @@ export function renderClient(opts) {
|
|
|
207
203
|
clientLoaderData: clientLoaderData,
|
|
208
204
|
serverLoaderData: serverLoaderData,
|
|
209
205
|
preloadRoute: handleRouteChange
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
});
|
|
206
|
+
}
|
|
207
|
+
}, rootContainer);
|
|
213
208
|
};
|
|
214
209
|
|
|
215
210
|
if (opts.hydrate) {
|
|
216
|
-
ReactDOM.hydrateRoot(rootElement, /*#__PURE__*/
|
|
211
|
+
ReactDOM.hydrateRoot(rootElement, /*#__PURE__*/React.createElement(Browser, null));
|
|
217
212
|
} else {
|
|
218
213
|
if (ReactDOM.createRoot) {
|
|
219
214
|
root = ReactDOM.createRoot(rootElement);
|
|
220
|
-
root.render( /*#__PURE__*/
|
|
215
|
+
root.render( /*#__PURE__*/React.createElement(Browser, null));
|
|
221
216
|
} else {
|
|
222
217
|
// @ts-ignore
|
|
223
|
-
ReactDOM.render( /*#__PURE__*/
|
|
218
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(Browser, null), rootElement);
|
|
224
219
|
}
|
|
225
220
|
}
|
|
226
221
|
}
|
package/package.json
CHANGED