Fix back button when directly opening subview (#16145)

This commit is contained in:
Paul Bottein 2023-04-13 21:16:59 +02:00 committed by GitHub
parent 2e7d973597
commit 178ad2dffa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -742,12 +742,14 @@ class HUIRoot extends LitElement {
const curViewConfig =
typeof this._curView === "number" ? views[this._curView] : undefined;
if (curViewConfig?.back_path) {
navigate(curViewConfig.back_path);
if (curViewConfig?.back_path != null) {
navigate(curViewConfig.back_path, { replace: true });
} else if (history.length > 1) {
history.back();
} else if (!views[0].subview) {
navigate(this.route!.prefix, { replace: true });
} else {
navigate(this.route!.prefix);
navigate("/");
}
}