vike 0.4.229-commit-af508ef → 0.4.229-commit-845a4e0

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.
@@ -59,8 +59,10 @@ const configDefinitionsBuiltIn = {
59
59
  env: { server: true }
60
60
  },
61
61
  onData: {
62
- env: { server: true, client: true },
62
+ env: { server: true, client: true }
63
+ /* TODO/now
63
64
  cumulative: true
65
+ */
64
66
  },
65
67
  iKnowThePerformanceRisksOfAsyncRouteFunctions: {
66
68
  env: { server: true, client: 'if-client-routing' },
@@ -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.229-commit-af508ef';
5
+ exports.PROJECT_VERSION = '0.4.229-commit-845a4e0';
@@ -73,6 +73,7 @@ async function getPageContextFromClientHooks(pageContext, isErrorPage) {
73
73
  objectAssign(pageContext, {
74
74
  _hasPageContextFromClient: false
75
75
  });
76
+ let dataHookExists = false;
76
77
  // At this point, we need to call the client-side guard(), data() and onBeforeRender() hooks, if they exist on client
77
78
  // env. However if we have fetched pageContext from the server, some of them might have run already on the
78
79
  // server-side, so we run only the client-only ones in this case.
@@ -89,7 +90,8 @@ async function getPageContextFromClientHooks(pageContext, isErrorPage) {
89
90
  }
90
91
  }
91
92
  else {
92
- assert(hookName === 'data' || hookName === 'onBeforeRender');
93
+ if (hookName === 'data')
94
+ dataHookExists = true;
93
95
  if (hookClientOnlyExists(hookName, pageContext) || !pageContext._hasPageContextFromServer) {
94
96
  // This won't do anything if no hook has been defined or if the hook's env.client is false.
95
97
  const pageContextFromHook = await executeHookClientSide(hookName, pageContext);
@@ -98,6 +100,14 @@ async function getPageContextFromClientHooks(pageContext, isErrorPage) {
98
100
  }
99
101
  }
100
102
  }
103
+ // Execute +onData
104
+ if (dataHookExists) {
105
+ const hook = getHookFromPageContext(pageContext, 'onData');
106
+ if (hook) {
107
+ const pageContextForUserConsumption = preparePageContextForUserConsumptionClientSide(pageContext, true);
108
+ await executeHook(() => hook.hookFn(pageContextForUserConsumption), hook, pageContext);
109
+ }
110
+ }
101
111
  const pageContextFromClientHooks = pageContext;
102
112
  return pageContextFromClientHooks;
103
113
  }
@@ -57,8 +57,10 @@ const configDefinitionsBuiltIn = {
57
57
  env: { server: true }
58
58
  },
59
59
  onData: {
60
- env: { server: true, client: true },
60
+ env: { server: true, client: true }
61
+ /* TODO/now
61
62
  cumulative: true
63
+ */
62
64
  },
63
65
  iKnowThePerformanceRisksOfAsyncRouteFunctions: {
64
66
  env: { server: true, client: 'if-client-routing' },
@@ -1 +1 @@
1
- export declare const PROJECT_VERSION: "0.4.229-commit-af508ef";
1
+ export declare const PROJECT_VERSION: "0.4.229-commit-845a4e0";
@@ -1,2 +1,2 @@
1
1
  // Automatically updated by @brillout/release-me
2
- export const PROJECT_VERSION = '0.4.229-commit-af508ef';
2
+ export const PROJECT_VERSION = '0.4.229-commit-845a4e0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.229-commit-af508ef",
3
+ "version": "0.4.229-commit-845a4e0",
4
4
  "repository": "https://github.com/vikejs/vike",
5
5
  "exports": {
6
6
  "./server": {