aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/util/CurrentUserUtils.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts
index d98eddb2e..6e115ea3c 100644
--- a/src/client/util/CurrentUserUtils.ts
+++ b/src/client/util/CurrentUserUtils.ts
@@ -1029,6 +1029,7 @@ export class CurrentUserUtils {
public static _urlState: HistoryUtil.DocUrl;
public static openDashboard = (doc: Doc, fromHistory = false) => {
+ if (!doc) return;
CurrentUserUtils.MainDocId = doc[Id];
Doc.AddDocToList(CurrentUserUtils.MyDashboards, "data", doc);
@@ -1134,9 +1135,10 @@ export class CurrentUserUtils {
public static removeDashboard = async (dashboard:Doc) => {
const dashboards = await DocListCastAsync(CurrentUserUtils.MyDashboards.data);
- if (dashboards && dashboards.length > 1) {
+ if (dashboards?.length) {
if (dashboard === CurrentUserUtils.ActiveDashboard) CurrentUserUtils.openDashboard(dashboards.find(doc => doc !== dashboard)!);
Doc.RemoveDocFromList(CurrentUserUtils.MyDashboards, "data", dashboard);
+ if (!dashboards.length) CurrentUserUtils.ActivePage = "home";
}
}
public static createNewDashboard = (id?: string, name?: string) => {