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.
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PROJECT_VERSION = void 0;
4
4
  // Automatically updated by @brillout/release-me
5
- exports.PROJECT_VERSION = '0.4.197-commit-ab2fbbe';
5
+ exports.PROJECT_VERSION = '0.4.197-commit-7d64995';
@@ -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-ab2fbbe";
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-ab2fbbe';
2
+ export const PROJECT_VERSION = '0.4.197-commit-7d64995';
@@ -1,4 +1,4 @@
1
1
  export declare const projectInfo: {
2
2
  projectName: "Vike";
3
- projectVersion: "0.4.197-commit-ab2fbbe";
3
+ projectVersion: "0.4.197-commit-7d64995";
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.197-commit-ab2fbbe",
3
+ "version": "0.4.197-commit-7d64995",
4
4
  "repository": "https://github.com/vikejs/vike",
5
5
  "exports": {
6
6
  "./server": {