do it immutable style
This commit is contained in:
@@ -57,16 +57,19 @@ export function useActorSearch({
|
|||||||
function select(data: InfiniteData<AppBskyActorSearchActors.OutputSchema>) {
|
function select(data: InfiniteData<AppBskyActorSearchActors.OutputSchema>) {
|
||||||
// enforce uniqueness
|
// enforce uniqueness
|
||||||
const dids = new Set()
|
const dids = new Set()
|
||||||
for (const page of data.pages) {
|
|
||||||
const actors = []
|
return {
|
||||||
for (const actor of page.actors) {
|
...data,
|
||||||
if (dids.has(actor.did)) continue
|
pages: data.pages.map(page => ({
|
||||||
dids.add(actor.did)
|
actors: page.actors.filter(actor => {
|
||||||
actors.push(actor)
|
if (dids.has(actor.did)) {
|
||||||
}
|
return false
|
||||||
page.actors = actors
|
}
|
||||||
|
dids.add(actor.did)
|
||||||
|
return true
|
||||||
|
}),
|
||||||
|
})),
|
||||||
}
|
}
|
||||||
return data
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function* findAllProfilesInQueryData(
|
export function* findAllProfilesInQueryData(
|
||||||
|
|||||||
Reference in New Issue
Block a user