From c32491abf30dfa6c9f5fe4c3797a9bf2db25a39e Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Thu, 13 Jan 2022 19:44:02 +0000 Subject: [PATCH] fix: fix server last section state --- src/mobx/stores/Layout.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/mobx/stores/Layout.ts b/src/mobx/stores/Layout.ts index 14c551a5..baaa157f 100644 --- a/src/mobx/stores/Layout.ts +++ b/src/mobx/stores/Layout.ts @@ -133,7 +133,7 @@ export default class Layout implements Store, Persistent { */ @action setLastOpened(server: string, channel: string) { this.lastOpened.set(server, channel); - this.lastSection = "server"; + this.lastSection = server; } /** @@ -149,11 +149,15 @@ export default class Layout implements Store, Persistent { * @returns Last path */ @computed getLastPath() { - return this.lastSection === "discover" - ? this.lastDiscoverPath - : this.lastSection === "home" - ? this.lastHomePath - : this.getLastOpened(this.lastSection)!; + return ( + (this.lastSection === "discover" + ? this.lastDiscoverPath + : this.lastSection === "home" + ? this.lastHomePath + : this.getServerPath(this.lastSection)!) ?? + this.lastHomePath ?? + "/" + ); } /**