-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf(solana): Optimize rendering times when using default connectionConfig #1246
Conversation
🦋 Changeset detectedLatest commit: 5d8b6ab The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1246 +/- ##
=======================================
Coverage 99.99% 99.99%
=======================================
Files 858 858
Lines 18297 18303 +6
Branches 1593 1595 +2
=======================================
+ Hits 18296 18302 +6
Misses 1 1 ☔ View full report in Codecov by Sentry. |
Co-authored-by: thinkasany <[email protected]>
Co-authored-by: thinkasany <[email protected]>
Co-authored-by: thinkasany <[email protected]>
OK,有些事情耽搁了。已修改。 |
看起来 solana 那边生成的文档有问题,丢失了一些类型。 |
Issue has been created solana-labs/solana-web3.js#3586 |
单独给文档加个pr好了,看看咋补救比较好。 |
当未提供
connectionConfig
属性值时,由于 ConnectionProvider#config 属性默认值的缘故,会导致多次渲染。最终导致重复发起获取余额的请求。这个 PR 优化了相关逻辑,使用 useMemo 缓存了 ConnectionProvider 需要的 props 来减少渲染次数。
When the connectionConfig prop value is not provided, the default value of the ConnectionProvider#config property causes multiple renders. This eventually leads to duplicate requests for fetching the balance.
This PR optimizes the related logic by using useMemo to cache the props needed by ConnectionProvider, reducing the number of renders.
Before:
![image](https://private-user-images.githubusercontent.com/18319675/386937113-14aac5ca-5adf-44ed-899f-6435523a42d2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzMDY4MzEsIm5iZiI6MTczOTMwNjUzMSwicGF0aCI6Ii8xODMxOTY3NS8zODY5MzcxMTMtMTRhYWM1Y2EtNWFkZi00NGVkLTg5OWYtNjQzNTUyM2E0MmQyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjExVDIwNDIxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU4YTdkYzIwMTczMWU5NTY5YTU3MTdkMjkwY2Q1ODZiMTA5NDIxZmMzNDAxNDEzNzA2YWQ0M2VjNWM2OTZlYWUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.rHVLU9RELwcFfKBJM9AmRbJHWc-zb2VSthtYi17_iVE)
💡 Background and solution
🔗 Related issue link