From 1b2746c1bf84a9fc28d2c02348ac5e05327da72b Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Thu, 20 Nov 2025 13:40:28 +0200 Subject: [PATCH] do it immutable style --- src/state/queries/actor-search.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/state/queries/actor-search.ts b/src/state/queries/actor-search.ts index 615c39eb41..84e6d88f29 100644 --- a/src/state/queries/actor-search.ts +++ b/src/state/queries/actor-search.ts @@ -57,16 +57,19 @@ export function useActorSearch({ function select(data: InfiniteData) { // enforce uniqueness const dids = new Set() - for (const page of data.pages) { - const actors = [] - for (const actor of page.actors) { - if (dids.has(actor.did)) continue - dids.add(actor.did) - actors.push(actor) - } - page.actors = actors + + return { + ...data, + pages: data.pages.map(page => ({ + actors: page.actors.filter(actor => { + if (dids.has(actor.did)) { + return false + } + dids.add(actor.did) + return true + }), + })), } - return data } export function* findAllProfilesInQueryData(