Skip to content

Commit 9414201

Browse files
authored
V16: Tree Stores should be optional to use (#19858)
* feat: makes tree stores optional and deprecates dependent methods * allow `Example` as class prefix * docs: updates example to remove the treeStore * deprecates the usage of treeStore contexts * chore: adds deprecation warnings to all existing tree stores
1 parent 39b395c commit 9414201

File tree

56 files changed

+150
-41
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+150
-41
lines changed

src/Umbraco.Web.UI.Client/.storybook/preview.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ class UmbStoryBookElement extends UmbLitElement {
128128
super();
129129
new UmbExtensionsApiInitializer(this, umbExtensionsRegistry, 'globalContext', [this]);
130130
new UmbExtensionsApiInitializer(this, umbExtensionsRegistry, 'store', [this]);
131+
// TODO: Remove this in Umbraco 18, use the repository instead
131132
new UmbExtensionsApiInitializer(this, umbExtensionsRegistry, 'treeStore', [this]);
132133
new UmbExtensionsApiInitializer(this, umbExtensionsRegistry, 'itemStore', [this]);
133134

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
import { manifests as repositoryManifests } from './repository/manifests.js';
2-
import { manifests as storeManifests } from './store/manifests.js';
32

4-
export const manifests: Array<UmbExtensionManifest> = [...repositoryManifests, ...storeManifests];
3+
export const manifests: Array<UmbExtensionManifest> = [...repositoryManifests];

src/Umbraco.Web.UI.Client/examples/tree/tree/data/repository/tree.repository.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { ExampleTreeItemModel, ExampleTreeRootModel } from '../../types.js';
22
import { EXAMPLE_ROOT_ENTITY_TYPE } from '../../../entity.js';
3-
import { EXAMPLE_TREE_STORE_CONTEXT } from '../store/index.js';
43
import { ExampleTreeLocalDataSource } from '../local-data-source/index.js';
54
import { UmbTreeRepositoryBase, type UmbTreeRepository } from '@umbraco-cms/backoffice/tree';
65
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
@@ -11,7 +10,7 @@ export class ExampleTreeRepository
1110
implements UmbTreeRepository, UmbApi
1211
{
1312
constructor(host: UmbControllerHost) {
14-
super(host, ExampleTreeLocalDataSource, EXAMPLE_TREE_STORE_CONTEXT);
13+
super(host, ExampleTreeLocalDataSource);
1514
}
1615

1716
async requestTreeRoot() {

src/Umbraco.Web.UI.Client/examples/tree/tree/data/store/constants.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/Umbraco.Web.UI.Client/examples/tree/tree/data/store/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/Umbraco.Web.UI.Client/examples/tree/tree/data/store/manifests.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/Umbraco.Web.UI.Client/examples/tree/tree/data/store/tree.store.context-token.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/Umbraco.Web.UI.Client/examples/tree/tree/data/store/tree.store.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/Umbraco.Web.UI.Client/src/packages/core/entry-point.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ import './entity-item/global-components.js';
1414
export const onInit: UmbEntryPointOnInit = (host, extensionRegistry) => {
1515
new UmbExtensionsApiInitializer(host, extensionRegistry, 'globalContext', [host]);
1616
new UmbExtensionsApiInitializer(host, extensionRegistry, 'store', [host]);
17+
/**
18+
* TODO: Remove this in Umbraco 18, use the repository instead
19+
*/
1720
new UmbExtensionsApiInitializer(host, extensionRegistry, 'treeStore', [host]);
1821
new UmbExtensionsApiInitializer(host, extensionRegistry, 'itemStore', [host]);
1922

src/Umbraco.Web.UI.Client/src/packages/core/extension-registry/extensions/store.extension.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import type { UmbTreeStore } from '@umbraco-cms/backoffice/tree';
55
export interface ManifestStore extends ManifestApi<any> {
66
type: 'store';
77
}
8-
// TODO: TREE STORE TYPE PROBLEM: Provide a base tree item type?
8+
9+
/**
10+
* Manifest for a tree store.
11+
* @deprecated - You do not need to register a treeStore manifest anymore, as the tree repository will be queried each time it is needed. This will be removed in Umbraco 18.
12+
*/
913
export interface ManifestTreeStore extends ManifestApi<UmbTreeStore<any>> {
1014
type: 'treeStore';
1115
}

0 commit comments

Comments
 (0)