@lwrjs/view-registry 0.14.3 → 0.14.4
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 +6 -2
- package/build/es/index.js +8 -2
- package/package.json +7 -7
package/build/cjs/index.cjs
CHANGED
|
@@ -140,11 +140,15 @@ var LwrViewRegistry = class {
|
|
|
140
140
|
const {contentTemplate, rootComponent} = viewId;
|
|
141
141
|
const compiledViewCacheKey = (0, import_shared_utils.getCacheKeyFromJson)({contentTemplate, rootComponent});
|
|
142
142
|
import_diagnostics.logger.debug(`[view-registry][getView] compiledViewCacheKey=${compiledViewCacheKey}`);
|
|
143
|
-
|
|
143
|
+
const route = this.globalConfig.routes.find((r) => r.id === viewId.id);
|
|
144
|
+
const skipCaching = route?.cache?.ttl === 0;
|
|
145
|
+
if (!skipCaching && this.compiledViews.has(compiledViewCacheKey)) {
|
|
144
146
|
return this.compiledViews.get(compiledViewCacheKey);
|
|
145
147
|
}
|
|
146
148
|
const compiledView = await this.delegateGetView(viewId);
|
|
147
|
-
|
|
149
|
+
if (!skipCaching) {
|
|
150
|
+
this.compiledViews.set(compiledViewCacheKey, compiledView);
|
|
151
|
+
}
|
|
148
152
|
return compiledView;
|
|
149
153
|
}
|
|
150
154
|
hasViewDefinition(view, viewParams, runtimeEnvironment, runtimeParams, renderOptions) {
|
package/build/es/index.js
CHANGED
|
@@ -127,12 +127,18 @@ export class LwrViewRegistry {
|
|
|
127
127
|
const { contentTemplate, rootComponent } = viewId;
|
|
128
128
|
const compiledViewCacheKey = getCacheKeyFromJson({ contentTemplate, rootComponent });
|
|
129
129
|
logger.debug(`[view-registry][getView] compiledViewCacheKey=${compiledViewCacheKey}`);
|
|
130
|
+
// For now we are only supporting ttl 0 == skipCaching.
|
|
131
|
+
const route = this.globalConfig.routes.find((r) => r.id === viewId.id);
|
|
132
|
+
const skipCaching = route?.cache?.ttl === 0;
|
|
130
133
|
// use cached compiledView if available
|
|
131
|
-
if (this.compiledViews.has(compiledViewCacheKey)) {
|
|
134
|
+
if (!skipCaching && this.compiledViews.has(compiledViewCacheKey)) {
|
|
132
135
|
return this.compiledViews.get(compiledViewCacheKey);
|
|
133
136
|
}
|
|
134
137
|
const compiledView = await this.delegateGetView(viewId);
|
|
135
|
-
|
|
138
|
+
// cache the compiled view
|
|
139
|
+
if (!skipCaching) {
|
|
140
|
+
this.compiledViews.set(compiledViewCacheKey, compiledView);
|
|
141
|
+
}
|
|
136
142
|
return compiledView;
|
|
137
143
|
}
|
|
138
144
|
hasViewDefinition(view, viewParams, runtimeEnvironment, runtimeParams, renderOptions) {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.14.
|
|
7
|
+
"version": "0.14.4",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -33,17 +33,17 @@
|
|
|
33
33
|
"build": "tsc -b"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@lwrjs/app-service": "0.14.
|
|
37
|
-
"@lwrjs/diagnostics": "0.14.
|
|
38
|
-
"@lwrjs/instrumentation": "0.14.
|
|
39
|
-
"@lwrjs/shared-utils": "0.14.
|
|
36
|
+
"@lwrjs/app-service": "0.14.4",
|
|
37
|
+
"@lwrjs/diagnostics": "0.14.4",
|
|
38
|
+
"@lwrjs/instrumentation": "0.14.4",
|
|
39
|
+
"@lwrjs/shared-utils": "0.14.4",
|
|
40
40
|
"lru-cache": "^10.4.3"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@lwrjs/types": "0.14.
|
|
43
|
+
"@lwrjs/types": "0.14.4"
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": ">=18.0.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "a92ceeb679faacfd0085d6dbdbf18cac86a588ef"
|
|
49
49
|
}
|