From 8ded118135a5e296a83a85cf3f2180be56c6a045 Mon Sep 17 00:00:00 2001 From: bobzel Date: Tue, 13 Sep 2022 22:36:49 -0400 Subject: fixed mainContainer on mainView to always show the activeDashboard if it exists. --- src/client/views/DashboardView.tsx | 9 +-------- src/client/views/MainView.tsx | 1 + 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/client/views/DashboardView.tsx b/src/client/views/DashboardView.tsx index 35aa67ac8..6415601f1 100644 --- a/src/client/views/DashboardView.tsx +++ b/src/client/views/DashboardView.tsx @@ -53,14 +53,7 @@ export class DashboardView extends React.Component { clickDashboard = async (e: React.MouseEvent, dashboard: Doc) => { if (e.detail === 2) { Doc.AddDocToList(Doc.MySharedDocs, 'viewed', dashboard); - if (DocListCast(Doc.MySharedDocs.data).includes(dashboard)) { - // choose an appropriate alias or make one. --- choose the first alias that (1) user owns, (2) has no context field ... otherwise make a new alias - const bestAlias = DocListCast(dashboard.aliases).find(doc => doc.author === Doc.CurrentUserEmail); - const nextBestAlias = DocListCast(dashboard.aliases).find(doc => doc.author === Doc.CurrentUserEmail); - Doc.ActiveDashboard = bestAlias ?? nextBestAlias ?? Doc.MakeAlias(dashboard); - } else { - Doc.ActiveDashboard = dashboard; - } + Doc.ActiveDashboard = dashboard; Doc.ActivePage = 'dashboard'; } }; diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index 4bf6bb881..c1cc80163 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -115,6 +115,7 @@ export class MainView extends React.Component { } @observable mainDoc: Opt; @computed private get mainContainer() { + if (Doc.ActiveDashboard) return Doc.ActiveDashboard; if (window.location.pathname.startsWith('/doc/')) { DocServer.GetRefField(window.location.pathname.substring('/doc/'.length)).then(main => runInAction(() => (this.mainDoc = main as Doc))); return this.mainDoc; -- cgit v1.2.3-70-g09d2