about summary refs log tree commit diff
path: root/src/state/models
diff options
context:
space:
mode:
authorPatroll <6214736+P4tr0ll@users.noreply.github.com>2023-10-04 19:31:43 +0200
committerGitHub <noreply@github.com>2023-10-04 10:31:43 -0700
commit9278822088d212c9bee6a40a6a8b773bc482242d (patch)
tree72751140ef2bda744a89fb457fa9398b72cae9ab /src/state/models
parent2ba0c6a711a5e33f5dd0cdde23123cb336c8f991 (diff)
downloadvoidsky-9278822088d212c9bee6a40a6a8b773bc482242d.tar.zst
Fix invite codes flash on desktop, use loading placeholder (#1591)
* Fix invite codes flashing untrue value before loaded

* Add loading placeholder for right nav invites
Diffstat (limited to 'src/state/models')
-rw-r--r--src/state/models/me.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/state/models/me.ts b/src/state/models/me.ts
index 186e61cf6..8a7a4c851 100644
--- a/src/state/models/me.ts
+++ b/src/state/models/me.ts
@@ -25,13 +25,13 @@ export class MeModel {
   savedFeeds: SavedFeedsModel
   notifications: NotificationsFeedModel
   follows: MyFollowsCache
-  invites: ComAtprotoServerDefs.InviteCode[] = []
+  invites: ComAtprotoServerDefs.InviteCode[] | null = []
   appPasswords: ComAtprotoServerListAppPasswords.AppPassword[] = []
   lastProfileStateUpdate = Date.now()
   lastNotifsUpdate = Date.now()
 
   get invitesAvailable() {
-    return this.invites.filter(isInviteAvailable).length
+    return this.invites?.filter(isInviteAvailable).length || null
   }
 
   constructor(public rootStore: RootStoreModel) {
@@ -180,7 +180,9 @@ export class MeModel {
       } catch (e) {
         this.rootStore.log.error('Failed to fetch user invite codes', e)
       }
-      await this.rootStore.invitedUsers.fetch(this.invites)
+      if (this.invites) {
+        await this.rootStore.invitedUsers.fetch(this.invites)
+      }
     }
   }