Skip to content

Commit 6366776

Browse files
loivseniOvergaard
authored andcommitted
update tree on dropzone upload
1 parent 3b65ead commit 6366776

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/packages/media/media/collection/media-collection.element.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { UMB_MEDIA_ENTITY_TYPE, UMB_MEDIA_ROOT_ENTITY_TYPE } from '../entity.js';
12
import { UMB_MEDIA_WORKSPACE_CONTEXT } from '../workspace/media-workspace.context-token.js';
23
import type { UmbMediaCollectionContext } from './media-collection.context.js';
34
import { UMB_MEDIA_COLLECTION_CONTEXT } from './media-collection.context-token.js';
@@ -6,6 +7,8 @@ import { UmbCollectionDefaultElement } from '@umbraco-cms/backoffice/collection'
67
import type { UmbProgressEvent } from '@umbraco-cms/backoffice/event';
78

89
import './media-collection-toolbar.element.js';
10+
import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action';
11+
import { UmbRequestReloadChildrenOfEntityEvent } from '@umbraco-cms/backoffice/entity-action';
912

1013
@customElement('umb-media-collection')
1114
export class UmbMediaCollectionElement extends UmbCollectionDefaultElement {
@@ -29,9 +32,16 @@ export class UmbMediaCollectionElement extends UmbCollectionDefaultElement {
2932
});
3033
}
3134

32-
#onChange() {
35+
async #onChange() {
3336
this._progress = -1;
3437
this.#mediaCollection?.requestCollection();
38+
39+
const eventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT);
40+
const event = new UmbRequestReloadChildrenOfEntityEvent({
41+
entityType: this._unique ? UMB_MEDIA_ENTITY_TYPE : UMB_MEDIA_ROOT_ENTITY_TYPE,
42+
unique: this._unique,
43+
});
44+
eventContext.dispatchEvent(event);
3545
}
3646

3747
#onProgress(event: UmbProgressEvent) {

0 commit comments

Comments
 (0)