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