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
This commit is contained in:
Niels Lyngsø
2025-10-31 10:52:10 +01:00
committed by GitHub
parent aadf5e7643
commit bd94522237
3 changed files with 8 additions and 8 deletions

View File

@@ -188,6 +188,12 @@ export class UmbTreeItemChildrenManager<
* @memberof UmbTreeItemChildrenManager
*/
public async loadChildren(): Promise<void> {
const target = this.targetPagination.getBaseTarget();
/* If a new target is set we only want to reload children if the new target isnt among the already loaded items. */
if (target && this.isChildLoaded(target)) {
return;
}
return this.#loadChildren();
}
@@ -244,7 +250,7 @@ export class UmbTreeItemChildrenManager<
? this.targetPagination.getNumberOfCurrentItemsBeforeBaseTarget()
: this.#takeBeforeTarget !== undefined
? this.#takeBeforeTarget
: 5,
: this.targetPagination.getTakeSize(),
takeAfter: reload
? this.targetPagination.getNumberOfCurrentItemsAfterBaseTarget()
: this.#takeAfterTarget !== undefined

View File

@@ -94,12 +94,6 @@ export class UmbTreeItemTargetExpansionManager<
return;
}
/* If a new target is set we only want to reload children if the new target isnt among the already loaded items. */
const targetIsLoaded = this.#childrenManager.isChildLoaded(target);
if (target && targetIsLoaded) {
return;
}
// If we already have children and the target didn't change then we don't have to load new children
const isNewTarget = target !== currentBaseTarget;
if (isExpanded && this.#childrenManager.hasLoadedChildren() && !isNewTarget) {

View File

@@ -40,7 +40,7 @@ export class UmbDocumentTreeItemContext extends UmbDefaultTreeItemContext<
this.hasCollection,
(hasCollection) => {
if (hasCollection) {
this._treeItemChildrenManager.setTargetTakeSize(2, 2);
this._treeItemChildrenManager.setTargetTakeSize(1, 1);
this.observe(
this.hasActiveDescendant,