Closed AMIRKHANEF closed 2 months ago
The changes across multiple components in the codebase focus on refactoring the management of recent chains in local storage, enhancing code maintainability and readability. A new utility function, updateRecentChains
, centralizes the logic for updating recent chains, while several components like Chain
, FullscreenChain
, and SelectChain
have been adjusted to utilize this function. Additionally, state management and component interactions have been streamlined for better efficiency.
Files & Path | Change Summary |
---|---|
packages/.../Chain.tsx , packages/.../FullscreenChain.tsx , packages/.../SelectChain.tsx |
Refactored to use updateRecentChains utility for managing recent chains, enhancing modular design and maintainability. Formatting adjustments made. |
packages/.../RecentChains.tsx |
Introduced useInfo for data retrieval, added initiateRecentChains for initialization logic, and refined state management and chain display logic. |
packages/.../popup/home/AccountDetail.tsx |
Removed currentChainName from props passed to RecentChains , simplifying data handling. |
packages/.../util/types.ts |
Added RecentChainsType for structured representation of recent chains. |
packages/.../util/utils.ts |
Introduced updateRecentChains function for better management of recent chains storage, and adjusted function signatures for consistency. |
sequenceDiagram
participant User
participant ChainComponent
participant RecentChainsUtility
User->>ChainComponent: Change Network
ChainComponent->>RecentChainsUtility: Call updateRecentChains(address, currentGenesisHash)
RecentChainsUtility-->>ChainComponent: Update success
ChainComponent-->>User: Display updated recent chains
Objective | Addressed | Explanation |
---|---|---|
RecentChains has issue by displaying 4 chains instead of 3 (#1498) | β |
π In the code beneath the moon,
New functions bloom, making changes soon.
Recent chains now tidy and neat,
With logic thatβs modular, oh what a treat!
Refactoring brings a joyful cheer,
For clearer paths are finally here! πβ¨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Works Done
'util/types.ts'
.RecentChains.tsx
props.updateRecentChains
function in'util/utils.ts'
updateRecentChains
.Close: #1498
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Documentation
Style