diff options
author | Ansh Nanda <anshnanda10@gmail.com> | 2023-05-23 15:28:46 -0700 |
---|---|---|
committer | Ansh Nanda <anshnanda10@gmail.com> | 2023-05-23 15:28:46 -0700 |
commit | fc9e28ca72ce498df8d0902c8e51d226affefd83 (patch) | |
tree | 4f9d54dd7e2cc59852d81d6bf29ea53bec830eca /src/state/models/ui | |
parent | b561a51ed9f798194c3c6a72eefab562a773f2c9 (diff) | |
download | voidsky-fc9e28ca72ce498df8d0902c8e51d226affefd83.tar.zst |
slight performance improvements
Diffstat (limited to 'src/state/models/ui')
-rw-r--r-- | src/state/models/ui/preferences.ts | 8 | ||||
-rw-r--r-- | src/state/models/ui/saved-feeds.ts | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/state/models/ui/preferences.ts b/src/state/models/ui/preferences.ts index c4b6da0f6..dcf6b9a7a 100644 --- a/src/state/models/ui/preferences.ts +++ b/src/state/models/ui/preferences.ts @@ -292,11 +292,15 @@ export class PreferencesModel { return res } + setFeeds(saved: string[], pinned: string[]) { + this.savedFeeds = saved + this.pinnedFeeds = pinned + } + async setSavedFeeds(saved: string[], pinned: string[]) { const oldSaved = this.savedFeeds const oldPinned = this.pinnedFeeds - this.savedFeeds = saved - this.pinnedFeeds = pinned + this.setFeeds(saved, pinned) try { await this.update((prefs: AppBskyActorDefs.Preferences) => { const existing = prefs.find( diff --git a/src/state/models/ui/saved-feeds.ts b/src/state/models/ui/saved-feeds.ts index 244e75898..979fddf49 100644 --- a/src/state/models/ui/saved-feeds.ts +++ b/src/state/models/ui/saved-feeds.ts @@ -47,6 +47,10 @@ export class SavedFeedsModel { return this.feeds.filter(f => !this.isPinned(f)) } + get all() { + return this.pinned.concat(this.unpinned) + } + get pinnedFeedNames() { return this.pinned.map(f => f.displayName) } |