Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.

Commit 42fdb3a

Browse files
committed
update structure after entity action is done
1 parent 2187f19 commit 42fdb3a

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

src/packages/documents/documents/entity-actions/public-access/public-access.action.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
import { UMB_PUBLIC_ACCESS_MODAL } from './modal/public-access-modal.token.js';
22
import type { UmbEntityActionArgs } from '@umbraco-cms/backoffice/entity-action';
3-
import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action';
3+
import {
4+
UmbEntityActionBase,
5+
UmbRequestReloadChildrenOfEntityEvent,
6+
UmbRequestReloadStructureForEntityEvent,
7+
} from '@umbraco-cms/backoffice/entity-action';
48
import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
59
import type { UmbDocumentDetailRepository } from '@umbraco-cms/backoffice/document';
10+
import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action';
611

712
export class UmbDocumentPublicAccessEntityAction extends UmbEntityActionBase<never> {
813
constructor(host: UmbDocumentDetailRepository, args: UmbEntityActionArgs<never>) {
@@ -14,5 +19,23 @@ export class UmbDocumentPublicAccessEntityAction extends UmbEntityActionBase<nev
1419
const modalManager = await this.getContext(UMB_MODAL_MANAGER_CONTEXT);
1520
const modal = modalManager.open(this, UMB_PUBLIC_ACCESS_MODAL, { data: { unique: this.args.unique } });
1621
await modal.onSubmit();
22+
this.#requestReloadEntity();
23+
}
24+
25+
async #requestReloadEntity() {
26+
const actionEventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT);
27+
28+
const entityStructureEvent = new UmbRequestReloadStructureForEntityEvent({
29+
unique: this.args.unique,
30+
entityType: this.args.entityType,
31+
});
32+
33+
const entityChildrenEvent = new UmbRequestReloadChildrenOfEntityEvent({
34+
unique: this.args.unique,
35+
entityType: this.args.entityType,
36+
});
37+
38+
actionEventContext.dispatchEvent(entityStructureEvent);
39+
actionEventContext.dispatchEvent(entityChildrenEvent);
1740
}
1841
}

0 commit comments

Comments
 (0)