MetaMask / MetaMask/metamask-mobile
Create reusable hook to start/stop Gas Polling when a component is mount/un-mount
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 1.7k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 669
Description
### **Description**
Gas polling functions are part of [GasPooling.js](https://github.com/MetaMask/metamask-mobile/blob/3c353f6a91f61630c843eb985ca309cf63dbd4c8/app/core/GasPolling/GasPolling.ts).
These functions are used by other components like [ApproveView](https://github.com/MetaMask/metamask-mobile/blob/main/app/components/Views/ApproveView/Approve/index.js#L208) to start / stop gas polling as the component mounts / un-mounts.
A re-usable hook can be created to extract out this code from functional components.
This task should be done after this one is completed: https://github.com/MetaMask/metamask-mobile/issues/5574
### **Acceptance Criteria**
- Gas polling work correctly using this new re-usable hook
- New code is test covered.
Contributor guide
Research direction
Start with app/core/GasPolling/GasPolling.ts and the gas-polling usage in app/components/Views/ApproveView/Approve/index.js around line 208. Check issue 5574 first, since this task depends on it. Done means mounting and unmounting through the reusable hook starts and stops gas polling correctly, with test coverage added.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, react-native, typescript
- Domain
- frontend, mobile-dev
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100