perf: implement multicall batching in useFetchSubmittedLists#18
perf: implement multicall batching in useFetchSubmittedLists#18ManiBAJPAI22 wants to merge 1 commit intokleros:masterfrom
Conversation
👷 Deploy request for kleros-governor-v2 pending review.Visit the deploys page to approve it
|
WalkthroughRefactored Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Optimize useFetchSubmittedLists Hook with Multicall Batching
What does this PR do?
Refactors the
useFetchSubmittedListshook to usepublicClient.multicallinstead of individualreadContractcalls, batching all contract calls into a single request for significantly better performance.Why is this change needed?
The current implementation makes N separate RPC calls for N list IDs, causing unnecessary network overhead and slower data loading. This becomes especially problematic with poor network conditions or when fetching many lists.
How does it work?
getSubmissioncalls into onemulticallrequestlistIdPerformance improvement
What stays the same?
Summary by CodeRabbit
Bug Fixes
Performance
✏️ Tip: You can customize this high-level summary in your review settings.