Skip to content

Commit

Permalink
fix fe cache hit issue (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
yesil authored Dec 9, 2024
1 parent 40f440e commit 3011993
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions studio/src/mas-recently-updated.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class MasRecentlyUpdated extends LitElement {
super.connectedCallback();
this.aem = new AEM(this.bucket, this.baseUrl);
this.source = document.getElementById(this.source);
this.loadFragments();
}

handleClick(e) {
Expand All @@ -57,8 +56,12 @@ class MasRecentlyUpdated extends LitElement {
}

async loadFragments() {
this.loading = true;
this.fragments = [];
if (!this.path) {
this.loading = false;
return;
}
this.loading = true;
const cursor = await this.aem.sites.cf.fragments.search(
{
sort: [{ on: 'modifiedOrCreated', order: 'DESC' }],
Expand All @@ -68,8 +71,9 @@ class MasRecentlyUpdated extends LitElement {
6,
);
const result = await cursor.next();
this.fragments = result.value.map((item) => new Fragment(item, this));
this.source.addToCache(this.fragments);
const fragments = result.value.map((item) => new Fragment(item, this));
await this.source.addToCache(fragments);
this.fragments = fragments;
this.loading = false;
}

Expand All @@ -80,10 +84,6 @@ class MasRecentlyUpdated extends LitElement {
@dblclick="${(e) => this.handleDoubleClick(e, fragment)}"
>
<aem-fragment fragment="${fragment.id}" ims author></aem-fragment>
<sp-status-light
size="l"
variant="${fragment.statusVariant}"
></sp-status-light>
</merch-card>`;
}

Expand Down

0 comments on commit 3011993

Please sign in to comment.