bugifx: correct display of document tree item invariant name
This commit is contained in:
@@ -45,8 +45,17 @@ export class UmbDocumentTreeItemElement extends UmbTreeItemElementBase<UmbDocume
|
||||
return this.item?.variants.find((x) => x.culture === culture);
|
||||
}
|
||||
|
||||
#isInvariant() {
|
||||
const firstVariant = this.item?.variants[0];
|
||||
return firstVariant?.culture === null && firstVariant?.segment === null;
|
||||
}
|
||||
|
||||
// TODO: we should move the fallback name logic to a helper class. It will be used in multiple places
|
||||
#getLabel() {
|
||||
if (this.#isInvariant()) {
|
||||
return this._item?.variants[0].name;
|
||||
}
|
||||
|
||||
const fallbackName = this.#getVariant(this._defaultCulture)?.name ?? this._item?.variants[0].name ?? 'Unknown';
|
||||
return this._variant?.name ?? `(${fallbackName})`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user