vike 0.4.197-commit-ab2fbbe → 0.4.197-commit-7d64995
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/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/client/client-routing-runtime/prefetch.d.ts +2 -2
- package/dist/esm/client/client-routing-runtime/prefetch.js +4 -0
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.js +4 -4
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/projectInfo.d.ts +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ export { addLinkPrefetchHandlers };
|
|
|
6
6
|
export { addLinkPrefetchHandlers_watch };
|
|
7
7
|
export { addLinkPrefetchHandlers_unwatch };
|
|
8
8
|
import { type PageContextFromServerHooks, getPageContextFromServerHooks } from './getPageContextFromHooks.js';
|
|
9
|
-
import { PageFile } from '../../shared/getPageFiles.js';
|
|
9
|
+
import type { PageContextExports, PageFile } from '../../shared/getPageFiles.js';
|
|
10
10
|
import { type PageConfigRuntime } from '../../shared/page-configs/PageConfig.js';
|
|
11
11
|
type ResultPageContextFromServer = Awaited<ReturnType<typeof getPageContextFromServerHooks>>;
|
|
12
12
|
type PageContextForPrefetch = {
|
|
@@ -19,7 +19,7 @@ type PageContextForPrefetch = {
|
|
|
19
19
|
};
|
|
20
20
|
declare function getPageContextPrefetched(pageContext: {
|
|
21
21
|
urlPathname: string;
|
|
22
|
-
}): null | PageContextFromServerHooks;
|
|
22
|
+
} & PageContextExports): null | PageContextFromServerHooks;
|
|
23
23
|
declare function populatePageContextPrefetchCache(pageContext: PageContextForPrefetch, result: ResultPageContextFromServer): void;
|
|
24
24
|
/**
|
|
25
25
|
* Programmatically prefetch client assets.
|
|
@@ -27,6 +27,10 @@ const globalObject = getGlobalObject('prefetch.ts', {
|
|
|
27
27
|
prefetchedPageContexts: {}
|
|
28
28
|
});
|
|
29
29
|
function getPageContextPrefetched(pageContext) {
|
|
30
|
+
const prefetchSettings = getPrefetchSettings(pageContext, null);
|
|
31
|
+
// TODO/pageContext-prefetch: we need linkTag to make this condition work
|
|
32
|
+
if (!prefetchSettings.pageContext)
|
|
33
|
+
return null;
|
|
30
34
|
const key = getCacheKey(pageContext.urlPathname);
|
|
31
35
|
const found = globalObject.prefetchedPageContexts[key];
|
|
32
36
|
if (!found || found.result.is404ServerSideRouted || isExpired(found))
|
|
@@ -53,10 +53,9 @@ async function renderPageClientSide(renderArgs) {
|
|
|
53
53
|
const onError = async (err) => {
|
|
54
54
|
await renderErrorPage({ err });
|
|
55
55
|
};
|
|
56
|
-
const pageContext = await getPageContextBegin();
|
|
56
|
+
const pageContext = await getPageContextBegin(false);
|
|
57
57
|
if (isRenderOutdated())
|
|
58
58
|
return;
|
|
59
|
-
objectAssign(pageContext, { isHydration: isFirstRender });
|
|
60
59
|
// onPageTransitionStart()
|
|
61
60
|
if (globalObject.isFirstRenderDone) {
|
|
62
61
|
assert(previousPageContext);
|
|
@@ -217,11 +216,12 @@ async function renderPageClientSide(renderArgs) {
|
|
|
217
216
|
await renderPageView(pageContext);
|
|
218
217
|
}
|
|
219
218
|
}
|
|
220
|
-
async function getPageContextBegin() {
|
|
219
|
+
async function getPageContextBegin(isForErrorPage) {
|
|
221
220
|
const pageContext = await createPageContext(urlOriginal);
|
|
222
221
|
objectAssign(pageContext, {
|
|
223
222
|
isBackwardNavigation,
|
|
224
223
|
isClientSideNavigation,
|
|
224
|
+
isHydration: isFirstRender && !isForErrorPage,
|
|
225
225
|
_previousPageContext: previousPageContext
|
|
226
226
|
});
|
|
227
227
|
{
|
|
@@ -256,7 +256,7 @@ async function renderPageClientSide(renderArgs) {
|
|
|
256
256
|
// We handle the abort error down below.
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
|
-
const pageContext = await getPageContextBegin();
|
|
259
|
+
const pageContext = await getPageContextBegin(true);
|
|
260
260
|
if (isRenderOutdated())
|
|
261
261
|
return;
|
|
262
262
|
if (args.is404)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.197-commit-
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.197-commit-7d64995";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.197-commit-
|
|
2
|
+
export const PROJECT_VERSION = '0.4.197-commit-7d64995';
|