Skip to content

Commit 7efb507

Browse files
committed
fix: use more performant map
1 parent 83a644d commit 7efb507

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

server/api/atproto/author-profiles.get.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ export default defineCachedEventHandler(
4949

5050
if (handles.length === 0) {
5151
return {
52-
authors: authors.map(author => ({
53-
...author,
54-
avatar: null,
55-
profileUrl: null,
56-
})),
52+
authors: authors.map(author => Object.assign(author, { avatar: null, profileUrl: null })),
5753
}
5854
}
5955

@@ -68,11 +64,14 @@ export default defineCachedEventHandler(
6864
}
6965
}
7066

71-
const resolvedAuthors: ResolvedAuthor[] = authors.map(author => ({
72-
...author,
73-
avatar: author.blueskyHandle ? avatarMap.get(author.blueskyHandle) || null : null,
74-
profileUrl: author.blueskyHandle ? `https://bsky.app/profile/${author.blueskyHandle}` : null,
75-
}))
67+
const resolvedAuthors: ResolvedAuthor[] = authors.map(author =>
68+
Object.assign(author, {
69+
avatar: author.blueskyHandle ? avatarMap.get(author.blueskyHandle) || null : null,
70+
profileUrl: author.blueskyHandle
71+
? `https://bsky.app/profile/${author.blueskyHandle}`
72+
: null,
73+
}),
74+
)
7675

7776
return { authors: resolvedAuthors }
7877
},

0 commit comments

Comments
 (0)