@lwrjs/view-registry 0.17.2-alpha.8 → 0.17.2-alpha.9
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/build/cjs/index.cjs +4 -3
- package/build/es/index.js +6 -3
- package/package.json +7 -7
package/build/cjs/index.cjs
CHANGED
|
@@ -189,13 +189,14 @@ var LwrViewRegistry = class {
|
|
|
189
189
|
const updatableViewParams = {...viewParams};
|
|
190
190
|
(0, import_utils.generateViewNonce)(updatableViewParams);
|
|
191
191
|
const pendingViewDefCacheKey = viewDefCacheKey + viewParamKey;
|
|
192
|
-
const
|
|
192
|
+
const pendingViewDefCacheKeyHashed = (0, import_crypto.createHash)("md5").update(pendingViewDefCacheKey).digest("hex");
|
|
193
|
+
const viewDefinition = await this.pendingViewDefinitions.execute(pendingViewDefCacheKeyHashed, () => (0, import_instrumentation.getTracer)().trace({
|
|
193
194
|
name: import_instrumentation.ViewSpan.RenderView,
|
|
194
195
|
attributes: {
|
|
195
196
|
view: view.id,
|
|
196
197
|
ssr: view.bootstrap?.ssr === true
|
|
197
198
|
}
|
|
198
|
-
}, () => this.renderView(view, updatableViewParams, runtimeEnvironment, runtimeParams,
|
|
199
|
+
}, () => this.renderView(view, updatableViewParams, runtimeEnvironment, runtimeParams, pendingViewDefCacheKeyHashed, renderOptions)));
|
|
199
200
|
viewDefinition.nonce = (0, import_utils.getViewNonce)(updatableViewParams);
|
|
200
201
|
const route = this.globalConfig.routes.find((r) => r.id === view.id);
|
|
201
202
|
const maxViewCacheTtl = (0, import_shared_utils.getFeatureFlags)().MAX_VIEW_CACHE_TTL;
|
|
@@ -221,7 +222,7 @@ var LwrViewRegistry = class {
|
|
|
221
222
|
}
|
|
222
223
|
async renderView(view, viewParams, runtimeEnvironment, runtimeParams, viewCacheKey, renderOptions) {
|
|
223
224
|
const {id, contentTemplate, rootComponent, layoutTemplate} = view;
|
|
224
|
-
const lwrResourcesId = `__LWR_RESOURCES__${
|
|
225
|
+
const lwrResourcesId = `__LWR_RESOURCES__${viewCacheKey}`;
|
|
225
226
|
const renderedContent = await this.render({id, contentTemplate, rootComponent}, {...viewParams, lwr_resources: lwrResourcesId}, runtimeParams, runtimeEnvironment);
|
|
226
227
|
let normalizedRenderOptions = (0, import_utils.normalizeRenderOptions)(this.runtimeEnvironment, renderedContent.options, renderOptions);
|
|
227
228
|
const layout = layoutTemplate || renderedContent.compiledView.layoutTemplate;
|
package/build/es/index.js
CHANGED
|
@@ -196,13 +196,16 @@ export class LwrViewRegistry {
|
|
|
196
196
|
const updatableViewParams = { ...viewParams };
|
|
197
197
|
generateViewNonce(updatableViewParams);
|
|
198
198
|
const pendingViewDefCacheKey = viewDefCacheKey + viewParamKey;
|
|
199
|
-
const
|
|
199
|
+
const pendingViewDefCacheKeyHashed = createHash('md5')
|
|
200
|
+
.update(pendingViewDefCacheKey)
|
|
201
|
+
.digest('hex');
|
|
202
|
+
const viewDefinition = await this.pendingViewDefinitions.execute(pendingViewDefCacheKeyHashed, () => getTracer().trace({
|
|
200
203
|
name: ViewSpan.RenderView,
|
|
201
204
|
attributes: {
|
|
202
205
|
view: view.id,
|
|
203
206
|
ssr: view.bootstrap?.ssr === true,
|
|
204
207
|
},
|
|
205
|
-
}, () => this.renderView(view, updatableViewParams, runtimeEnvironment, runtimeParams,
|
|
208
|
+
}, () => this.renderView(view, updatableViewParams, runtimeEnvironment, runtimeParams, pendingViewDefCacheKeyHashed, renderOptions)));
|
|
206
209
|
// Once the view is generated add the nonce to the response so it can be cached and then added to the headers
|
|
207
210
|
viewDefinition.nonce = getViewNonce(updatableViewParams);
|
|
208
211
|
const route = this.globalConfig.routes.find((r) => r.id === view.id);
|
|
@@ -238,7 +241,7 @@ export class LwrViewRegistry {
|
|
|
238
241
|
}
|
|
239
242
|
async renderView(view, viewParams, runtimeEnvironment, runtimeParams, viewCacheKey, renderOptions) {
|
|
240
243
|
const { id, contentTemplate, rootComponent, layoutTemplate } = view;
|
|
241
|
-
const lwrResourcesId = `__LWR_RESOURCES__${
|
|
244
|
+
const lwrResourcesId = `__LWR_RESOURCES__${viewCacheKey}`;
|
|
242
245
|
const renderedContent = await this.render({ id, contentTemplate, rootComponent }, { ...viewParams, lwr_resources: lwrResourcesId }, runtimeParams, runtimeEnvironment);
|
|
243
246
|
// normalize the renderOptions provided by the CompiledView content with the request options.
|
|
244
247
|
let normalizedRenderOptions = normalizeRenderOptions(this.runtimeEnvironment, renderedContent.options, renderOptions);
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.17.2-alpha.
|
|
7
|
+
"version": "0.17.2-alpha.9",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"build": "tsc -b"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@lwrjs/app-service": "0.17.2-alpha.
|
|
37
|
-
"@lwrjs/diagnostics": "0.17.2-alpha.
|
|
38
|
-
"@lwrjs/instrumentation": "0.17.2-alpha.
|
|
39
|
-
"@lwrjs/shared-utils": "0.17.2-alpha.
|
|
36
|
+
"@lwrjs/app-service": "0.17.2-alpha.9",
|
|
37
|
+
"@lwrjs/diagnostics": "0.17.2-alpha.9",
|
|
38
|
+
"@lwrjs/instrumentation": "0.17.2-alpha.9",
|
|
39
|
+
"@lwrjs/shared-utils": "0.17.2-alpha.9",
|
|
40
40
|
"lru-cache": "^10.4.3"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@lwrjs/types": "0.17.2-alpha.
|
|
43
|
+
"@lwrjs/types": "0.17.2-alpha.9"
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": ">=18.0.0"
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"volta": {
|
|
49
49
|
"extends": "../../../package.json"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "7ede5d04a97513b9869b13e66155bc4f3920bb99"
|
|
52
52
|
}
|