Skip to content
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

Merged
merged 6 commits into from
Nov 18, 2024

Conversation

gin-lsl
Copy link
Collaborator

@gin-lsl gin-lsl commented Nov 17, 2024

当未提供 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

💡 Background and solution

🔗 Related issue link

Copy link

changeset-bot bot commented Nov 17, 2024

🦋 Changeset detected

Latest commit: 5d8b6ab

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@ant-design/web3-solana Patch

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

Copy link

vercel bot commented Nov 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ant-design-web3 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 18, 2024 4:37am

Copy link

github-actions bot commented Nov 17, 2024

Preview is ready

Copy link

codecov bot commented Nov 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.99%. Comparing base (ff8e95f) to head (5d8b6ab).
Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

@thinkasany
Copy link
Collaborator

这里需要你手动改,没有changed的地方好像给不到suggestion
image

@gin-lsl
Copy link
Collaborator Author

gin-lsl commented Nov 18, 2024

这里需要你手动改

OK,有些事情耽搁了。已修改。

@thinkasany
Copy link
Collaborator

@gin-lsl
Copy link
Collaborator Author

gin-lsl commented Nov 18, 2024

看起来 solana 那边生成的文档有问题,丢失了一些类型。

@gin-lsl
Copy link
Collaborator Author

gin-lsl commented Nov 18, 2024

Issue has been created solana-labs/solana-web3.js#3586

@thinkasany
Copy link
Collaborator

看起来 solana 那边生成的文档有问题,丢失了一些类型。

单独给文档加个pr好了,看看咋补救比较好。

@gin-lsl gin-lsl merged commit 1161b63 into main Nov 18, 2024
14 checks passed
@gin-lsl gin-lsl deleted the perf/solana-render-times branch November 18, 2024 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants