@@ -3,25 +3,27 @@ import {
3
3
UMB_CREATE_DOCUMENT_TYPE_WORKSPACE_PRESET_ELEMENT ,
4
4
UMB_CREATE_DOCUMENT_TYPE_WORKSPACE_PRESET_TEMPLATE ,
5
5
UMB_EDIT_DOCUMENT_TYPE_WORKSPACE_PATH_PATTERN ,
6
- type UmbCreateDocumentTypeWorkspacePresetType ,
7
6
} from '../../paths.js' ;
7
+ import type { UmbCreateDocumentTypeWorkspacePresetType } from '../../paths.js' ;
8
8
import type { UmbDocumentTypeDetailModel } from '../../types.js' ;
9
9
import { UMB_DOCUMENT_TYPE_ENTITY_TYPE , UMB_DOCUMENT_TYPE_DETAIL_REPOSITORY_ALIAS } from '../../constants.js' ;
10
- import { UmbDocumentTypeWorkspaceEditorElement } from './document-type-workspace-editor.element.js' ;
11
10
import { UMB_DOCUMENT_TYPE_WORKSPACE_ALIAS } from './constants.js' ;
11
+ import { UmbDocumentTypeWorkspaceEditorElement } from './document-type-workspace-editor.element.js' ;
12
+ import { CompositionTypeModel } from '@umbraco-cms/backoffice/external/backend-api' ;
12
13
import { UmbContentTypeWorkspaceContextBase } from '@umbraco-cms/backoffice/content-type' ;
14
+ import { UmbRequestReloadChildrenOfEntityEvent } from '@umbraco-cms/backoffice/entity-action' ;
13
15
import {
14
16
UmbWorkspaceIsNewRedirectController ,
15
17
UmbWorkspaceIsNewRedirectControllerAlias ,
16
18
} from '@umbraco-cms/backoffice/workspace' ;
19
+ import { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action' ;
20
+ import { UMB_TEMPLATE_ROOT_ENTITY_TYPE , UmbTemplateDetailRepository } from '@umbraco-cms/backoffice/template' ;
17
21
import type { UmbContentTypeSortModel , UmbContentTypeWorkspaceContext } from '@umbraco-cms/backoffice/content-type' ;
18
22
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api' ;
23
+ import type { UmbEntityModel } from '@umbraco-cms/backoffice/entity' ;
24
+ import type { UmbPathPatternTypeAsEncodedParamsType } from '@umbraco-cms/backoffice/router' ;
19
25
import type { UmbReferenceByUnique } from '@umbraco-cms/backoffice/models' ;
20
26
import type { UmbRoutableWorkspaceContext } from '@umbraco-cms/backoffice/workspace' ;
21
- import type { UmbPathPatternTypeAsEncodedParamsType } from '@umbraco-cms/backoffice/router' ;
22
- import type { UmbEntityModel } from '@umbraco-cms/backoffice/entity' ;
23
- import { UmbTemplateDetailRepository } from '@umbraco-cms/backoffice/template' ;
24
- import { CompositionTypeModel } from '@umbraco-cms/backoffice/external/backend-api' ;
25
27
26
28
type DetailModelType = UmbDocumentTypeDetailModel ;
27
29
export class UmbDocumentTypeWorkspaceContext
@@ -189,6 +191,16 @@ export class UmbDocumentTypeWorkspaceContext
189
191
const { data : template } = await this . #templateRepository. create ( templateScaffold , null ) ;
190
192
if ( ! template ) throw new Error ( 'Could not create template' ) ;
191
193
194
+ const eventContext = await this . getContext ( UMB_ACTION_EVENT_CONTEXT ) ;
195
+ if ( ! eventContext ) {
196
+ throw new Error ( 'Could not get the action event context' ) ;
197
+ }
198
+ const event = new UmbRequestReloadChildrenOfEntityEvent ( {
199
+ entityType : UMB_TEMPLATE_ROOT_ENTITY_TYPE ,
200
+ unique : null ,
201
+ } ) ;
202
+ eventContext . dispatchEvent ( event ) ;
203
+
192
204
const templateEntity = { id : template . unique } ;
193
205
const allowedTemplates = this . getAllowedTemplateIds ( ) ?? [ ] ;
194
206
this . setAllowedTemplateIds ( [ templateEntity , ...allowedTemplates ] ) ;
0 commit comments