Skip to content

Commit b4220a4

Browse files
committed
Collection children: A slim navigation of collection children + higher take above target (#20641)
* enforce update of children when collection * only load one above and below collection children * take 50 above a target for default experience * revert reset target * remove old impl
1 parent 973a957 commit b4220a4

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/Umbraco.Web.UI.Client/src/packages/core/tree/tree-item/tree-item-children.manager.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@ export class UmbTreeItemChildrenManager<
188188
* @memberof UmbTreeItemChildrenManager
189189
*/
190190
public async loadChildren(): Promise<void> {
191+
const target = this.targetPagination.getBaseTarget();
192+
/* If a new target is set we only want to reload children if the new target isn’t among the already loaded items. */
193+
if (target && this.isChildLoaded(target)) {
194+
return;
195+
}
196+
191197
return this.#loadChildren();
192198
}
193199

@@ -244,7 +250,7 @@ export class UmbTreeItemChildrenManager<
244250
? this.targetPagination.getNumberOfCurrentItemsBeforeBaseTarget()
245251
: this.#takeBeforeTarget !== undefined
246252
? this.#takeBeforeTarget
247-
: 5,
253+
: this.targetPagination.getTakeSize(),
248254
takeAfter: reload
249255
? this.targetPagination.getNumberOfCurrentItemsAfterBaseTarget()
250256
: this.#takeAfterTarget !== undefined

src/Umbraco.Web.UI.Client/src/packages/core/tree/tree-item/tree-item-expansion.manager.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,6 @@ export class UmbTreeItemTargetExpansionManager<
9494
return;
9595
}
9696

97-
/* If a new target is set we only want to reload children if the new target isn’t among the already loaded items. */
98-
const targetIsLoaded = this.#childrenManager.isChildLoaded(target);
99-
if (target && targetIsLoaded) {
100-
return;
101-
}
102-
10397
// If we already have children and the target didn't change then we don't have to load new children
10498
const isNewTarget = target !== currentBaseTarget;
10599
if (isExpanded && this.#childrenManager.hasLoadedChildren() && !isNewTarget) {

src/Umbraco.Web.UI.Client/src/packages/documents/documents/tree/tree-item/document-tree-item.context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class UmbDocumentTreeItemContext extends UmbDefaultTreeItemContext<
4040
this.hasCollection,
4141
(hasCollection) => {
4242
if (hasCollection) {
43-
this._treeItemChildrenManager.setTargetTakeSize(2, 2);
43+
this._treeItemChildrenManager.setTargetTakeSize(1, 1);
4444

4545
this.observe(
4646
this.hasActiveDescendant,

0 commit comments

Comments
 (0)