Et2Tree: Avoid some errors on first leaf selection

This commit is contained in:
nathan 2024-02-14 11:29:08 -07:00
parent 27418ec0f4
commit 5f26b940e3

View File

@ -625,9 +625,9 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement)
.selection=${this.multiple ? "multiple" : "single"}
@sl-selection-change=${
(event: any) => {
this._previousOption = this._currentOption || this.getNode(this.value);
this._previousOption = this._currentOption ?? (this.value.length ? this.getNode(this.value) : null);
this._currentOption = this.getNode(event.detail.selection[0].id);
event.detail.previous = this._previousOption.id;
event.detail.previous = this._previousOption?.id;
this._currentSlTreeItem = event.detail.selection[0];
if(typeof this.onclick == "function")
{