@salesforce/lds-utils-adapters 1.309.0 → 1.311.0
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/dist/ldsAdapterUtils.js +7 -3
- package/package.json +1 -1
package/dist/ldsAdapterUtils.js
CHANGED
|
@@ -26,6 +26,7 @@ function runAdapterWithReport(adapterName, adapter, adapterConfig, requestContex
|
|
|
26
26
|
let networkStart;
|
|
27
27
|
let networkEnd;
|
|
28
28
|
let staleLookup = false;
|
|
29
|
+
let cacheLookupState = undefined;
|
|
29
30
|
let result;
|
|
30
31
|
let snapshotState = '';
|
|
31
32
|
let error;
|
|
@@ -189,14 +190,17 @@ function runAdapterWithReport(adapterName, adapter, adapterConfig, requestContex
|
|
|
189
190
|
// L2 cache hit
|
|
190
191
|
result = 'l2-hit';
|
|
191
192
|
}
|
|
193
|
+
cacheLookupState = ev.snapshotState;
|
|
192
194
|
if (ev.snapshotState === 'Stale') {
|
|
193
195
|
staleLookup = true;
|
|
194
196
|
}
|
|
195
197
|
break;
|
|
196
198
|
case 'network-lookup-start':
|
|
197
|
-
// if the lookup is stale
|
|
198
|
-
//
|
|
199
|
-
if (
|
|
199
|
+
// if the lookup is stale or fulfilled it wasnt a cache miss
|
|
200
|
+
// but refreshed due to explicitly being asked (cache-and-network) or because it was stale
|
|
201
|
+
if (cacheLookupState &&
|
|
202
|
+
cacheLookupState !== 'Stale' &&
|
|
203
|
+
cacheLookupState !== 'Fulfilled') {
|
|
200
204
|
result = 'cache-miss';
|
|
201
205
|
networkStart = Date.now();
|
|
202
206
|
}
|