@adobe/spacecat-shared-data-access 1.61.2 → 1.61.3
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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-data-access-v1.61.3](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.61.2...@adobe/spacecat-shared-data-access-v1.61.3) (2024-12-28)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* cache key ([#507](https://github.com/adobe/spacecat-shared/issues/507)) ([7146bfd](https://github.com/adobe/spacecat-shared/commit/7146bfd908e1bc13076bd58b3c24ca89b7f4c531))
|
|
7
|
+
|
|
1
8
|
# [@adobe/spacecat-shared-data-access-v1.61.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.61.1...@adobe/spacecat-shared-data-access-v1.61.2) (2024-12-27)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -48,13 +48,15 @@ class SiteCollection extends BaseCollection {
|
|
|
48
48
|
|
|
49
49
|
const sitesMap = new Map(sites.map((site) => [site.getId(), site]));
|
|
50
50
|
const orderedSites = [];
|
|
51
|
+
const cacheKey = `getLatestAuditByAuditType:["${auditType}"]`;
|
|
52
|
+
// getLatestAuditByAuditType:["cwv"]
|
|
51
53
|
|
|
52
54
|
// First, append sites with a latest audit in the sorted order
|
|
53
55
|
latestAudits.forEach((audit) => {
|
|
54
56
|
const site = sitesMap.get(audit.getSiteId());
|
|
55
57
|
if (site) {
|
|
56
58
|
// eslint-disable-next-line no-underscore-dangle
|
|
57
|
-
site._accessorCache[
|
|
59
|
+
site._accessorCache[cacheKey] = audit;
|
|
58
60
|
orderedSites.push(site);
|
|
59
61
|
sitesMap.delete(site.getId()); // Remove the site from the map to avoid adding it again
|
|
60
62
|
}
|
|
@@ -63,7 +65,7 @@ class SiteCollection extends BaseCollection {
|
|
|
63
65
|
// Then, append the remaining sites (without a latest audit)
|
|
64
66
|
sitesMap.forEach((site) => {
|
|
65
67
|
// eslint-disable-next-line no-underscore-dangle,no-param-reassign
|
|
66
|
-
site._accessorCache[
|
|
68
|
+
site._accessorCache[cacheKey] = null;
|
|
67
69
|
orderedSites.push(site);
|
|
68
70
|
});
|
|
69
71
|
|