Select, don't mutate (#4541)
parent
ba2fadb661
commit
f5f3bd8130
|
@ -234,26 +234,28 @@ export function useGetPopularFeedsQuery(options?: GetPopularFeedsOptions) {
|
||||||
data: InfiniteData<AppBskyUnspeccedGetPopularFeedGenerators.OutputSchema>,
|
data: InfiniteData<AppBskyUnspeccedGetPopularFeedGenerators.OutputSchema>,
|
||||||
) => {
|
) => {
|
||||||
const {savedFeeds, hasSession: hasSessionInner} = selectArgs
|
const {savedFeeds, hasSession: hasSessionInner} = selectArgs
|
||||||
data?.pages.map(page => {
|
return {
|
||||||
page.feeds = page.feeds.filter(feed => {
|
...data,
|
||||||
if (
|
pages: data.pages.map(page => {
|
||||||
!hasSessionInner &&
|
return {
|
||||||
KNOWN_AUTHED_ONLY_FEEDS.includes(feed.uri)
|
...page,
|
||||||
) {
|
feeds: page.feeds.filter(feed => {
|
||||||
return false
|
if (
|
||||||
}
|
!hasSessionInner &&
|
||||||
const alreadySaved = Boolean(
|
KNOWN_AUTHED_ONLY_FEEDS.includes(feed.uri)
|
||||||
savedFeeds?.find(f => {
|
) {
|
||||||
return f.value === feed.uri
|
return false
|
||||||
|
}
|
||||||
|
const alreadySaved = Boolean(
|
||||||
|
savedFeeds?.find(f => {
|
||||||
|
return f.value === feed.uri
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
return !alreadySaved
|
||||||
}),
|
}),
|
||||||
)
|
}
|
||||||
return !alreadySaved
|
}),
|
||||||
})
|
}
|
||||||
|
|
||||||
return page
|
|
||||||
})
|
|
||||||
|
|
||||||
return data
|
|
||||||
},
|
},
|
||||||
[selectArgs /* Don't change. Everything needs to go into selectArgs. */],
|
[selectArgs /* Don't change. Everything needs to go into selectArgs. */],
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in New Issue