1- import { NextResponse } from "next/server" ;
21import { unstable_cache } from "next/cache" ;
2+ import { NextResponse } from "next/server" ;
33import { fetchFarcasterProfilesByAddress } from "@/services/farcaster" ;
44import {
55 fetchActiveVotesForVoters ,
66 fetchAllMembers ,
77 fetchNonCanceledProposalsCount ,
8- fetchVotesCountForVoters ,
9- fetchVoteSupportForVoters ,
8+ fetchVoterActivity ,
109 type MemberListItem ,
1110} from "@/services/members" ;
1211
@@ -19,24 +18,22 @@ const getCachedMembers = unstable_cache(
1918 async ( ) : Promise < MemberListItem [ ] > => {
2019 const members = await fetchAllMembers ( ) ;
2120 const owners = members . map ( ( m ) => m . owner ) ;
22- const [
23- votesCountResult ,
24- activeVotesResult ,
25- nonCanceledResult ,
26- voteSupportResult ,
27- farcasterResult ,
28- ] = await Promise . allSettled ( [
29- fetchVotesCountForVoters ( owners ) ,
30- fetchActiveVotesForVoters ( owners ) ,
31- fetchNonCanceledProposalsCount ( ) ,
32- fetchVoteSupportForVoters ( owners ) ,
33- fetchFarcasterProfilesByAddress ( owners ) ,
34- ] ) ;
21+ const [ voterActivityResult , activeVotesResult , nonCanceledResult , farcasterResult ] =
22+ await Promise . allSettled ( [
23+ fetchVoterActivity ( owners ) ,
24+ fetchActiveVotesForVoters ( owners ) ,
25+ fetchNonCanceledProposalsCount ( ) ,
26+ fetchFarcasterProfilesByAddress ( owners ) ,
27+ ] ) ;
3528
36- const votesCountMap = votesCountResult . status === "fulfilled" ? votesCountResult . value : { } ;
29+ const voterActivity =
30+ voterActivityResult . status === "fulfilled"
31+ ? voterActivityResult . value
32+ : { counts : { } , support : { } } ;
33+ const votesCountMap = voterActivity . counts ;
34+ const voteSupportMap = voterActivity . support ;
3735 const activeVotesMap = activeVotesResult . status === "fulfilled" ? activeVotesResult . value : { } ;
3836 const nonCanceledCount = nonCanceledResult . status === "fulfilled" ? nonCanceledResult . value : 0 ;
39- const voteSupportMap = voteSupportResult . status === "fulfilled" ? voteSupportResult . value : { } ;
4037 const farcasterProfiles = farcasterResult . status === "fulfilled" ? farcasterResult . value : { } ;
4138
4239 return members . map ( ( m ) => {
0 commit comments