Skip to content

Commit

Permalink
pass refs through for post viewer state
Browse files Browse the repository at this point in the history
  • Loading branch information
devinivy committed Jan 3, 2024
1 parent 5e829ff commit 0b6752a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions packages/bsky/src/hydration/feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,21 @@ export class FeedHydrator {
}

async getPostViewerStates(
uris: string[],
refs: ItemRef[],
viewer: string,
): Promise<PostViewerStates> {
if (!uris.length) return new HydrationMap<PostViewerState>()
if (!refs.length) return new HydrationMap<PostViewerState>()
const [likes, reposts] = await Promise.all([
this.dataplane.getLikesByActorAndSubjects({
actorDid: viewer,
refs: uris.map((uri) => ({ uri })),
refs,
}),
this.dataplane.getRepostsByActorAndSubjects({
actorDid: viewer,
refs: uris.map((uri) => ({ uri })),
refs,
}),
])
return uris.reduce((acc, uri, i) => {
return refs.reduce((acc, { uri }, i) => {
return acc.set(uri, {
like: parseString(likes.uris[i]),
repost: parseString(reposts.uris[i]),
Expand Down
2 changes: 1 addition & 1 deletion packages/bsky/src/hydration/hydrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export class Hydrator {
feedGenState,
] = await Promise.all([
this.feed.getPostAggregates(refs),
viewer ? this.feed.getPostViewerStates(uris, viewer) : undefined,
viewer ? this.feed.getPostViewerStates(refs, viewer) : undefined,
this.label.getLabelsForSubjects(allPostUris),
this.hydratePostBlocks(posts),
this.hydrateProfiles(
Expand Down

0 comments on commit 0b6752a

Please sign in to comment.