Bluesky app fork with some witchin' additions 💫

Fix removal of old lists from saved feeds (#1823)

* Fix removal of old lists from saved feeds

* Fix saved feed removal race condition

authored by

Eric Bailey and committed by
GitHub
7ffbee18 a4baf14e

+20 -7
+9 -2
src/state/models/content/feed-source.ts
··· 142 142 } 143 143 144 144 async unsave() { 145 - if (this.type !== 'feed-generator') { 145 + // TODO TEMPORARY — see PRF's comment in content/list.ts togglePin 146 + if (this.type !== 'feed-generator' && this.type !== 'list') { 146 147 return 147 148 } 148 149 try { ··· 179 180 name: this.displayName, 180 181 uri: this.uri, 181 182 }) 182 - return this.rootStore.preferences.removePinnedFeed(this.uri) 183 + 184 + if (this.type === 'list') { 185 + // TODO TEMPORARY — see PRF's comment in content/list.ts togglePin 186 + return this.unsave() 187 + } else { 188 + return this.rootStore.preferences.removePinnedFeed(this.uri) 189 + } 183 190 } 184 191 } 185 192
+1 -1
src/state/models/content/list.ts
··· 361 361 name: this.data?.name || '', 362 362 uri: this.uri, 363 363 }) 364 - // TEMPORARY 364 + // TODO TEMPORARY 365 365 // lists are temporarily piggybacking on the saved/pinned feeds preferences 366 366 // we'll eventually replace saved feeds with the bookmarks API 367 367 // until then, we need to unsave lists instead of just unpin them
+10 -4
src/state/models/ui/saved-feeds.ts
··· 38 38 return this.hasLoaded && !this.hasContent 39 39 } 40 40 41 - get pinned() { 42 - return this.all.filter(feed => feed.isPinned) 41 + get pinned(): FeedSourceModel[] { 42 + return this.rootStore.preferences.savedFeeds 43 + .filter(feed => this.rootStore.preferences.isPinnedFeed(feed)) 44 + .map(uri => this.all.find(f => f.uri === uri)) 45 + .filter(Boolean) as FeedSourceModel[] 43 46 } 44 47 45 - get unpinned() { 46 - return this.all.filter(feed => !feed.isPinned) 48 + get unpinned(): FeedSourceModel[] { 49 + return this.rootStore.preferences.savedFeeds 50 + .filter(feed => !this.rootStore.preferences.isPinnedFeed(feed)) 51 + .map(uri => this.all.find(f => f.uri === uri)) 52 + .filter(Boolean) as FeedSourceModel[] 47 53 } 48 54 49 55 get pinnedFeedNames() {