@lwrjs/view-registry 0.14.3 → 0.14.5

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.
@@ -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
- if (this.compiledViews.has(compiledViewCacheKey)) {
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
- this.compiledViews.set(compiledViewCacheKey, compiledView);
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
- this.compiledViews.set(compiledViewCacheKey, compiledView);
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.3",
7
+ "version": "0.14.5",
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.3",
37
- "@lwrjs/diagnostics": "0.14.3",
38
- "@lwrjs/instrumentation": "0.14.3",
39
- "@lwrjs/shared-utils": "0.14.3",
36
+ "@lwrjs/app-service": "0.14.5",
37
+ "@lwrjs/diagnostics": "0.14.5",
38
+ "@lwrjs/instrumentation": "0.14.5",
39
+ "@lwrjs/shared-utils": "0.14.5",
40
40
  "lru-cache": "^10.4.3"
41
41
  },
42
42
  "devDependencies": {
43
- "@lwrjs/types": "0.14.3"
43
+ "@lwrjs/types": "0.14.5"
44
44
  },
45
45
  "engines": {
46
46
  "node": ">=18.0.0"
47
47
  },
48
- "gitHead": "088ef231f272ca6627c9b5bb962883d67f09c173"
48
+ "gitHead": "eab9d45135b28af734a94a0a461fad6f9a5f8300"
49
49
  }