Open AMIRKHANEF opened 2 days ago
The pull request introduces several modifications across multiple components in the PolkaGate extension. Key changes include refactoring function declarations to named exports and wrapping components with React.memo
for performance improvements. The Edit
and Review
components have undergone significant restructuring, including the introduction of a custom hook in Review
for transaction preparation. Type safety enhancements have been made, particularly in state management. Error handling and initialization logic have also been refined, while the overall functionality of the components remains consistent.
File | Change Summary |
---|---|
packages/extension-polkagate/src/fullscreen/stake/pool/commonTasks/editPool/Edit.tsx |
- Changed Edit from default export to named function with a memoized default export.- Clarified changes parameter type in setChanges .- Updated logic for the next button's disabled state for type safety. - Adjusted useEffect hooks. |
packages/extension-polkagate/src/fullscreen/stake/pool/commonTasks/editPool/Review.tsx |
- Extracted transaction preparation logic into usePoolTransactionPreparation hook.- Moved getRole function outside of Review .- Refactored transaction calls for readability. - Wrapped component with React.memo . |
packages/extension-polkagate/src/fullscreen/stake/pool/commonTasks/editPool/ShowPoolRole.tsx |
- Changed export statement to wrap ShowPoolRole with React.memo .- Simplified translation function call. |
packages/extension-polkagate/src/fullscreen/stake/pool/commonTasks/editPool/index.tsx |
- Wrapped ManageEditPool in React.memo for performance.- No changes to internal logic or props interface. |
packages/extension-polkagate/src/fullscreen/stake/pool/unstake/index.tsx |
- Updated handling of maxUnlockingChunks for type safety.- Expanded conditional checks for api variable.- Streamlined estimatedFee logic.- Modified onMaxAmount function for edge cases.- Enhanced error handling. |
Objective | Addressed | Explanation |
---|---|---|
Resolve infinite loop issue in Edit pool popup (1681) | ✅ |
Review
component may relate to the Edit
component as both involve modifications to their respective function signatures and the use of hooks.React.memo
, similar to the changes made in the Edit
component.SimpleModalTitle
component may relate to the changes in the Edit
component regarding component structure.Edit
component's state management.Divider
component's styling may relate to UI consistency across components, including Edit
.change requested
🐇 "In the meadow where we play,
Changes hop in bright array.
With hooks and memo, swift and neat,
Our code now dances to a beat!
Type safety and clarity, oh what a treat,
Let's celebrate this coding feat!" 🐇
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?
Close: #1681
Summary by CodeRabbit
Release Notes
New Features
Performance Improvements
React.memo
to optimize rendering and prevent unnecessary re-renders.Bug Fixes
Refactor