aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2022-06-27 13:04:01 -0400
committerbobzel <zzzman@gmail.com>2022-06-27 13:04:01 -0400
commit0b9f5fb60d5ee3b589e2e4628c5f1a737757492d (patch)
tree2c76f08fc1c40c1ebf0e4f440f81b0e3c345d73f /src
parente627759d038d7e732156b822d4fc7b39af9632a4 (diff)
from last
Diffstat (limited to 'src')
-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) => {