@lwrjs/view-registry 0.8.0-alpha.1 → 0.8.0-alpha.2
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 +2 -8
- package/build/es/index.js +3 -10
- package/package.json +6 -6
package/build/cjs/index.cjs
CHANGED
|
@@ -37,7 +37,7 @@ var LwrViewRegistry = class {
|
|
|
37
37
|
this.compiledViews = new Map();
|
|
38
38
|
this.viewDefinitions = new Map();
|
|
39
39
|
this.immutableAssets = new Map();
|
|
40
|
-
this.pendingViewDefinitions = new
|
|
40
|
+
this.pendingViewDefinitions = new import_shared_utils.InflightTasks();
|
|
41
41
|
this.name = "lwr-view-registry";
|
|
42
42
|
this.resourceRegistry = context.resourceRegistry;
|
|
43
43
|
this.runtimeEnvironment = context.runtimeEnvironment;
|
|
@@ -172,13 +172,7 @@ var LwrViewRegistry = class {
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
const pendingViewDefCacheKey = viewDefCacheKey + viewParamKey;
|
|
175
|
-
|
|
176
|
-
return this.pendingViewDefinitions.get(pendingViewDefCacheKey);
|
|
177
|
-
}
|
|
178
|
-
const pendingViewDefinition = this.renderView(view, viewParams, runtimeEnvironment, runtimeParams, renderOptions);
|
|
179
|
-
this.pendingViewDefinitions.set(pendingViewDefCacheKey, pendingViewDefinition);
|
|
180
|
-
const viewDefinition = await pendingViewDefinition;
|
|
181
|
-
this.pendingViewDefinitions.delete(pendingViewDefCacheKey);
|
|
175
|
+
const viewDefinition = await this.pendingViewDefinitions.execute(pendingViewDefCacheKey, () => this.renderView(view, viewParams, runtimeEnvironment, runtimeParams, renderOptions));
|
|
182
176
|
if (cacheDisabled === false) {
|
|
183
177
|
this.viewDefinitions.set(viewDefCacheKey, {
|
|
184
178
|
view,
|
package/build/es/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { extractMetadataFromHtml, getCacheKeyFromJson, getSpecifier, normalizeResourcePath, createStringBuilder, } from '@lwrjs/shared-utils';
|
|
1
|
+
import { extractMetadataFromHtml, getCacheKeyFromJson, getSpecifier, normalizeResourcePath, createStringBuilder, InflightTasks, } from '@lwrjs/shared-utils';
|
|
2
2
|
import { normalizeRenderOptions, normalizeRenderedResult, reduceSourceAssetReferences } from './utils.js';
|
|
3
3
|
import { linkLwrResources } from './linkers/link-lwr-resources.js';
|
|
4
4
|
export { LwrViewHandler } from './view-handler.js';
|
|
@@ -17,8 +17,7 @@ export class LwrViewRegistry {
|
|
|
17
17
|
//
|
|
18
18
|
// Pending view definitions are tracked to prevent concurrent resolution of the same view.
|
|
19
19
|
// Subsequent requests for the same view will await the original promise.
|
|
20
|
-
|
|
21
|
-
this.pendingViewDefinitions = new Map();
|
|
20
|
+
this.pendingViewDefinitions = new InflightTasks();
|
|
22
21
|
this.name = 'lwr-view-registry';
|
|
23
22
|
this.resourceRegistry = context.resourceRegistry;
|
|
24
23
|
this.runtimeEnvironment = context.runtimeEnvironment;
|
|
@@ -179,13 +178,7 @@ export class LwrViewRegistry {
|
|
|
179
178
|
}
|
|
180
179
|
}
|
|
181
180
|
const pendingViewDefCacheKey = viewDefCacheKey + viewParamKey;
|
|
182
|
-
|
|
183
|
-
return this.pendingViewDefinitions.get(pendingViewDefCacheKey);
|
|
184
|
-
}
|
|
185
|
-
const pendingViewDefinition = this.renderView(view, viewParams, runtimeEnvironment, runtimeParams, renderOptions);
|
|
186
|
-
this.pendingViewDefinitions.set(pendingViewDefCacheKey, pendingViewDefinition);
|
|
187
|
-
const viewDefinition = await pendingViewDefinition;
|
|
188
|
-
this.pendingViewDefinitions.delete(pendingViewDefCacheKey);
|
|
181
|
+
const viewDefinition = await this.pendingViewDefinitions.execute(pendingViewDefCacheKey, () => this.renderView(view, viewParams, runtimeEnvironment, runtimeParams, renderOptions));
|
|
189
182
|
if (cacheDisabled === false) {
|
|
190
183
|
this.viewDefinitions.set(viewDefCacheKey, {
|
|
191
184
|
view,
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.8.0-alpha.
|
|
7
|
+
"version": "0.8.0-alpha.2",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -30,15 +30,15 @@
|
|
|
30
30
|
"build/**/*.d.ts"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@lwrjs/app-service": "0.8.0-alpha.
|
|
34
|
-
"@lwrjs/diagnostics": "0.8.0-alpha.
|
|
35
|
-
"@lwrjs/shared-utils": "0.8.0-alpha.
|
|
33
|
+
"@lwrjs/app-service": "0.8.0-alpha.2",
|
|
34
|
+
"@lwrjs/diagnostics": "0.8.0-alpha.2",
|
|
35
|
+
"@lwrjs/shared-utils": "0.8.0-alpha.2"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@lwrjs/types": "0.8.0-alpha.
|
|
38
|
+
"@lwrjs/types": "0.8.0-alpha.2"
|
|
39
39
|
},
|
|
40
40
|
"engines": {
|
|
41
41
|
"node": ">=14.15.4 <19"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "44bee038acb30418870678d886e3ded4a6afecf0"
|
|
44
44
|
}
|