@shuvi/platform-web 1.0.41 → 1.0.43
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.
|
@@ -111,10 +111,7 @@ export const createApp = ({ routes, appData, appComponent }) => {
|
|
|
111
111
|
window.location.replace(location);
|
|
112
112
|
}
|
|
113
113
|
else {
|
|
114
|
-
next(
|
|
115
|
-
path: location,
|
|
116
|
-
replace: true
|
|
117
|
-
});
|
|
114
|
+
next(location);
|
|
118
115
|
}
|
|
119
116
|
runLoadersTrace.setAttribute(SHUVI_CLIENT_RUN_LOADERS.attrs.errorType.name, 'redirect');
|
|
120
117
|
runLoadersTrace.stop();
|
|
@@ -51,6 +51,8 @@ export const createApp = options => {
|
|
|
51
51
|
if (isRedirect(error)) {
|
|
52
52
|
const location = error.headers.get('Location');
|
|
53
53
|
const status = error.status;
|
|
54
|
+
// server side redirect is different from regular route redirect because it has the extra data - statusCode
|
|
55
|
+
// So it won't change route target, but just store the redirect location in state
|
|
54
56
|
next({
|
|
55
57
|
path: pathToString(to),
|
|
56
58
|
replace: true,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useMatchedRoute } from '@shuvi/router-react';
|
|
2
2
|
import { loaderModel, loaderModelName } from '@shuvi/platform-shared/shared';
|
|
3
3
|
import { useStaticModel } from './store';
|
|
4
|
-
export const noLoaderMessage = 'Warning: no loader found. Please make sure the page component where `useLoaderData` is called has a `loader` export.';
|
|
5
4
|
const hasOwn = Object.prototype.hasOwnProperty;
|
|
6
5
|
export const useLoaderData = () => {
|
|
7
6
|
const currentMatch = useMatchedRoute();
|
|
@@ -10,7 +9,7 @@ export const useLoaderData = () => {
|
|
|
10
9
|
// matched route
|
|
11
10
|
const loaderData = useStaticModel(loaderModelName, loaderModel);
|
|
12
11
|
if (!hasOwn.call(loaderData.dataByRouteId, id)) {
|
|
13
|
-
throw Error(
|
|
12
|
+
throw Error(`Loader data not found for route "${currentMatch.route.path}". Please make sure the page component where \`useLoaderData\` is called has a \`loader\` export.`);
|
|
14
13
|
}
|
|
15
14
|
return loaderData.dataByRouteId[id];
|
|
16
15
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shuvi/platform-web",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.43",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/shuvijs/shuvi.git",
|
|
@@ -72,15 +72,15 @@
|
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"@next/react-refresh-utils": "12.1.6",
|
|
75
|
-
"@shuvi/error-overlay": "1.0.
|
|
76
|
-
"@shuvi/hook": "1.0.
|
|
77
|
-
"@shuvi/platform-shared": "1.0.
|
|
78
|
-
"@shuvi/router": "1.0.
|
|
79
|
-
"@shuvi/router-react": "1.0.
|
|
80
|
-
"@shuvi/runtime": "1.0.
|
|
81
|
-
"@shuvi/shared": "1.0.
|
|
82
|
-
"@shuvi/toolpack": "1.0.
|
|
83
|
-
"@shuvi/utils": "1.0.
|
|
75
|
+
"@shuvi/error-overlay": "1.0.43",
|
|
76
|
+
"@shuvi/hook": "1.0.43",
|
|
77
|
+
"@shuvi/platform-shared": "1.0.43",
|
|
78
|
+
"@shuvi/router": "1.0.43",
|
|
79
|
+
"@shuvi/router-react": "1.0.43",
|
|
80
|
+
"@shuvi/runtime": "1.0.43",
|
|
81
|
+
"@shuvi/shared": "1.0.43",
|
|
82
|
+
"@shuvi/toolpack": "1.0.43",
|
|
83
|
+
"@shuvi/utils": "1.0.43",
|
|
84
84
|
"content-type": "1.0.4",
|
|
85
85
|
"core-js": "3.6.5",
|
|
86
86
|
"doura": "0.0.13",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"whatwg-fetch": "3.0.0"
|
|
99
99
|
},
|
|
100
100
|
"peerDependencies": {
|
|
101
|
-
"@shuvi/service": "1.0.
|
|
101
|
+
"@shuvi/service": "1.0.43"
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
104
|
"@shuvi/service": "workspace:*",
|