MetaMask / MetaMask/metamask-mobile
Prevent infinite recursive onClose in the `<BottomSheet>` component
@Prithpal-Sooriya is already working on this.
Since Apr 24, 2025.
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 1.7k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 669
Description
### What is this about?
Here is a minimal test example:
https://github.com/MetaMask/metamask-mobile/pull/14473
If a developer uses this `` component; uses both the `ref` and `onClose` props; and the `onClose` uses the ref callback to close (`onCloseBottomSheet()`), then the app will have a infinite recursive callstack when close is invoked.
We should either try to avoid this infinite recursive loop, or improve types and documentation to avoid teams from doing this.
### Scenario
See test in the test example:
https://github.com/MetaMask/metamask-mobile/pull/14473
Running this test showcases the bug.
### Design
_No response_
### Technical Details
_No response_
### Threat Modeling Framework
_No response_
### Acceptance Criteria
_No response_
### Stakeholder review needed before the work gets merged
- [ ] Engineering (needed in most cases)
- [x] Design
- [ ] Product
- [ ] QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
- [ ] Security
- [ ] Legal
- [ ] Marketing
- [ ] Management (please specify)
- [ ] Other (please specify)
### References
_No response_
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.