vike 0.4.240-commit-a80417c → 0.4.240-commit-82bb0c2
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/esm/client/runtime-client-routing/renderPageClientSide.js +19 -15
- package/dist/esm/client/runtime-client-routing/utils.d.ts +0 -1
- package/dist/esm/client/runtime-client-routing/utils.js +0 -1
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ export { getRenderCount };
|
|
|
3
3
|
export { disableClientRouting };
|
|
4
4
|
export { firstRenderStartPromise };
|
|
5
5
|
export { getPageContextClient };
|
|
6
|
-
import { assert,
|
|
6
|
+
import { assert, objectAssign, redirectHard, getGlobalObject, hasProp, updateType, genPromise, isCallable, catchInfiniteLoop, isObject, } from './utils.js';
|
|
7
7
|
import { getPageContextFromClientHooks, getPageContextFromServerHooks, getPageContextFromHooks_isHydration, getPageContextFromHooks_serialized, setPageContextInitIsPassedToClient, } from './getPageContextFromHooks.js';
|
|
8
8
|
import { createPageContextClientSide } from './createPageContextClientSide.js';
|
|
9
9
|
import { addLinkPrefetchHandlers, addLinkPrefetchHandlers_unwatch, addLinkPrefetchHandlers_watch, getPageContextPrefetched, populatePageContextPrefetchCache, } from './prefetch.js';
|
|
@@ -241,7 +241,7 @@ async function renderPageClientSide(renderArgs) {
|
|
|
241
241
|
// We don't swallow 404 errors:
|
|
242
242
|
// - On the server-side, Vike swallows / doesn't show any 404 error log because it's expected that a user may go to some random non-existent URL. (We don't want to flood the app's error tracking with 404 logs.)
|
|
243
243
|
// - On the client-side, if the user navigates to a 404 then it means that the UI has a broken link. (It isn't expected that users can go to some random URL using the client-side router, as it would require, for example, the user to manually change the URL of a link by manually manipulating the DOM which highly unlikely.)
|
|
244
|
-
|
|
244
|
+
logError(err);
|
|
245
245
|
}
|
|
246
246
|
else {
|
|
247
247
|
// We swallow throw redirect()/render() called by client-side hooks onBeforeRender()/data()/guard()
|
|
@@ -267,14 +267,12 @@ async function renderPageClientSide(renderArgs) {
|
|
|
267
267
|
}
|
|
268
268
|
async function renderErrorPage(pageContext, args, pageContextAbort) {
|
|
269
269
|
const onError = (err) => {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
console.error(err);
|
|
277
|
-
}
|
|
270
|
+
/* When we can't render the error page, we prefer showing a blank page over letting the server-side try because otherwise:
|
|
271
|
+
- We risk running into an infinite loop of reloads which would overload the server.
|
|
272
|
+
- An infinite reloading page is a even worse UX than a blank page.
|
|
273
|
+
redirectHard(urlOriginal)
|
|
274
|
+
*/
|
|
275
|
+
logError(err);
|
|
278
276
|
};
|
|
279
277
|
const errorPageId = getErrorPageId(pageContext._pageFilesAll, pageContext._globalContext._pageConfigs);
|
|
280
278
|
if (!errorPageId)
|
|
@@ -386,9 +384,7 @@ async function renderPageClientSide(renderArgs) {
|
|
|
386
384
|
await handleError({ err });
|
|
387
385
|
}
|
|
388
386
|
else {
|
|
389
|
-
|
|
390
|
-
console.error(err);
|
|
391
|
-
}
|
|
387
|
+
logError(err);
|
|
392
388
|
}
|
|
393
389
|
};
|
|
394
390
|
// We use globalObject.onRenderClientPreviousPromise in order to ensure that there is never two concurrent onRenderClient() calls
|
|
@@ -519,10 +515,10 @@ function changeUrl(url, overwriteLastHistoryEntry) {
|
|
|
519
515
|
pushHistoryState(url, overwriteLastHistoryEntry);
|
|
520
516
|
}
|
|
521
517
|
function disableClientRouting(err, log) {
|
|
522
|
-
assert(isErrorFetchingStaticAssets(err));
|
|
523
518
|
globalObject.clientRoutingIsDisabled = true;
|
|
519
|
+
assert(isErrorFetchingStaticAssets(err));
|
|
524
520
|
if (log) {
|
|
525
|
-
// We don't use console.error() to avoid flooding error trackers such as Sentry
|
|
521
|
+
// We purposely don't use console.error() to avoid flooding error trackers such as Sentry
|
|
526
522
|
console.log(err);
|
|
527
523
|
}
|
|
528
524
|
assertInfo(false, [
|
|
@@ -669,3 +665,11 @@ if (import.meta.env.DEV && import.meta.hot)
|
|
|
669
665
|
});
|
|
670
666
|
}
|
|
671
667
|
});
|
|
668
|
+
function logError(err) {
|
|
669
|
+
if (isObject(err) &&
|
|
670
|
+
// Set by vike-react
|
|
671
|
+
err.isAlreadyLogged) {
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
console.error(err);
|
|
675
|
+
}
|
|
@@ -7,7 +7,6 @@ export * from '../../utils/isCallable.js';
|
|
|
7
7
|
export * from '../../utils/isObject.js';
|
|
8
8
|
export * from '../../utils/isPlainObject.js';
|
|
9
9
|
export * from '../../utils/isReact.js';
|
|
10
|
-
export * from '../../utils/isSameErrorMessage.js';
|
|
11
10
|
export * from '../../utils/objectAssign.js';
|
|
12
11
|
export * from '../../utils/parseUrl.js';
|
|
13
12
|
export * from '../../utils/PromiseType.js';
|
|
@@ -11,7 +11,6 @@ export * from '../../utils/isCallable.js';
|
|
|
11
11
|
export * from '../../utils/isObject.js';
|
|
12
12
|
export * from '../../utils/isPlainObject.js';
|
|
13
13
|
export * from '../../utils/isReact.js';
|
|
14
|
-
export * from '../../utils/isSameErrorMessage.js';
|
|
15
14
|
export * from '../../utils/objectAssign.js';
|
|
16
15
|
export * from '../../utils/parseUrl.js';
|
|
17
16
|
export * from '../../utils/PromiseType.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.240-commit-
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.240-commit-82bb0c2";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.240-commit-
|
|
2
|
+
export const PROJECT_VERSION = '0.4.240-commit-82bb0c2';
|