allow to clear input of data trees, fyi @joaomoreno

This commit is contained in:
Johannes Rieken 2021-01-13 14:14:55 +01:00
parent dea0095e83
commit cf03ef33f4

View file

@ -47,13 +47,19 @@ export class DataTree<TInput, T, TFilterData = void> extends AbstractTree<T | nu
return this.input;
}
setInput(input: TInput, viewState?: IDataTreeViewState): void {
setInput(input: TInput | undefined, viewState?: IDataTreeViewState): void {
if (viewState && !this.identityProvider) {
throw new TreeError(this.user, 'Can\'t restore tree view state without an identity provider');
}
this.input = input;
if (!input) {
this.nodesByIdentity.clear();
this.model.setChildren(null, Iterable.empty());
return;
}
if (!viewState) {
this._refresh(input);
return;