about summary refs log tree commit diff
path: root/src/state/models/ui/profile.ts
diff options
context:
space:
mode:
authorFoysal Ahamed <foysal@blueskyweb.xyz>2023-07-28 18:04:27 +0200
committerGitHub <noreply@github.com>2023-07-28 11:04:27 -0500
commiteec300d77241925e6b42e5e7e51894f2cba50e18 (patch)
tree0fb74f898687a6331cba3a3f0cffe3354596f4ab /src/state/models/ui/profile.ts
parent38d78e16bffc9a25a45a4ad41caeef2c075daa26 (diff)
downloadvoidsky-eec300d77241925e6b42e5e7e51894f2cba50e18.tar.zst
List cleanup on remove (#1069)
* :lipstick: Hide Add to List option on own profile

* :sparkles: Remove Lists tab when last list is removed

* :sparkles: Add listener to list delete on profile screen

* :sparkles: Only show save changes in list modal when changes are made
Diffstat (limited to 'src/state/models/ui/profile.ts')
-rw-r--r--src/state/models/ui/profile.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/state/models/ui/profile.ts b/src/state/models/ui/profile.ts
index 81daf797f..a0249d768 100644
--- a/src/state/models/ui/profile.ts
+++ b/src/state/models/ui/profile.ts
@@ -87,7 +87,10 @@ export class ProfileUiModel {
   }
 
   get selectedView() {
-    return this.selectorItems[this.selectedViewIndex]
+    // If, for whatever reason, the selected view index is not available, default back to posts
+    // This can happen when the user was focused on a view but performed an action that caused
+    // the view to disappear (e.g. deleting the last list in their list of lists https://imgflip.com/i/7txu1y)
+    return this.selectorItems[this.selectedViewIndex] || Sections.Posts
   }
 
   get uiItems() {