Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: remove list from pinned once deleted (#2705)

authored by

Mary and committed by
GitHub
41860d8b 2d13f3b3

+25 -1
+25 -1
src/view/screens/ProfileList.tsx
··· 55 55 usePreferencesQuery, 56 56 usePinFeedMutation, 57 57 useUnpinFeedMutation, 58 + useSetSaveFeedsMutation, 58 59 } from '#/state/queries/preferences' 59 60 import {logger} from '#/logger' 60 61 import {useAnalytics} from '#/lib/analytics/analytics' ··· 246 247 useUnpinFeedMutation() 247 248 const isPending = isPinPending || isUnpinPending 248 249 const {data: preferences} = usePreferencesQuery() 250 + const {mutate: setSavedFeeds} = useSetSaveFeedsMutation() 249 251 const {track} = useAnalytics() 250 252 251 253 const isPinned = preferences?.feeds?.pinned?.includes(list.uri) 254 + const isSaved = preferences?.feeds?.saved?.includes(list.uri) 252 255 253 256 const onTogglePinned = React.useCallback(async () => { 254 257 Haptics.default() ··· 361 364 message: _(msg`Are you sure?`), 362 365 async onPressConfirm() { 363 366 await listDeleteMutation.mutateAsync({uri: list.uri}) 367 + 368 + if (isSaved || isPinned) { 369 + const {saved, pinned} = preferences!.feeds 370 + 371 + setSavedFeeds({ 372 + saved: isSaved ? saved.filter(uri => uri !== list.uri) : saved, 373 + pinned: isPinned ? pinned.filter(uri => uri !== list.uri) : pinned, 374 + }) 375 + } 376 + 364 377 Toast.show(_(msg`List deleted`)) 365 378 track('Lists:Delete') 366 379 if (navigation.canGoBack()) { ··· 370 383 } 371 384 }, 372 385 }) 373 - }, [openModal, list, listDeleteMutation, navigation, track, _]) 386 + }, [ 387 + openModal, 388 + list, 389 + listDeleteMutation, 390 + navigation, 391 + track, 392 + _, 393 + preferences, 394 + isPinned, 395 + isSaved, 396 + setSavedFeeds, 397 + ]) 374 398 375 399 const onPressReport = useCallback(() => { 376 400 openModal({