ensure collection is fully reloaded after an archived item is added o… (#2386)

…r removed

follow up to #2332

Testing:
1. Add or remove an archived item.
2. Switch to Replay view. Collection should reload and update the page
list.
This commit is contained in:
Ilya Kreymer 2025-02-11 23:12:47 -08:00 committed by GitHub
parent 3586412da1
commit 5b02d81991
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -75,6 +75,9 @@ export class CollectionDetail extends BtrixElement {
@state() @state()
private isRwpLoaded = false; private isRwpLoaded = false;
@state()
private rwpDoFullReload = false;
@consume({ context: viewStateContext }) @consume({ context: viewStateContext })
viewState?: ViewStateContext; viewState?: ViewStateContext;
@ -422,6 +425,8 @@ export class CollectionDetail extends BtrixElement {
} catch (e) { } catch (e) {
console.warn("Full reload not available in RWP"); console.warn("Full reload not available in RWP");
} }
} else {
this.rwpDoFullReload = true;
} }
} }
@ -903,6 +908,10 @@ export class CollectionDetail extends BtrixElement {
if (!this.isRwpLoaded) { if (!this.isRwpLoaded) {
this.isRwpLoaded = true; this.isRwpLoaded = true;
} }
if (this.rwpDoFullReload && this.replayEmbed) {
this.replayEmbed.fullReload();
this.rwpDoFullReload = false;
}
}} }}
></replay-web-page> ></replay-web-page>
</section>`; </section>`;
@ -1044,6 +1053,7 @@ export class CollectionDetail extends BtrixElement {
icon: "check2-circle", icon: "check2-circle",
id: "collection-item-remove-status", id: "collection-item-remove-status",
}); });
this.refreshReplay();
void this.fetchCollection(); void this.fetchCollection();
void this.fetchArchivedItems({ void this.fetchArchivedItems({
// Update page if last item // Update page if last item