[No QA] refactor: IOURequestStepScan clean-up, phase 4: fix react-hooks/exhaustive-deps warning#85642
[No QA] refactor: IOURequestStepScan clean-up, phase 4: fix react-hooks/exhaustive-deps warning#85642samranahm wants to merge 2 commits intoExpensify:mainfrom
IOURequestStepScan clean-up, phase 4: fix react-hooks/exhaustive-deps warning#85642Conversation
There was a problem hiding this comment.
Pull request overview
Refactors IOURequestStepScan (web + native) to eliminate react-hooks/exhaustive-deps suppressions as part of the ongoing cleanup plan for the scan step.
Changes:
- Web: updates the “validate initial scan files” effect to satisfy
exhaustive-depsby adding dependencies and auseRefguard. - Native: removes the
exhaustive-depssuppression oncapturePhotoand adds missing dependencies to the callback.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/pages/iou/request/step/IOURequestStepScan/index.tsx |
Adjusts a mount-time validation effect to comply with exhaustive-deps via deps + useRef guard. |
src/pages/iou/request/step/IOURequestStepScan/index.native.tsx |
Updates capturePhoto callback dependencies and removes the eslint suppression. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| useEffect(() => { | ||
| if (hasValidatedInitialScanFiles.current) { | ||
| return; | ||
| } | ||
| hasValidatedInitialScanFiles.current = true; | ||
|
|
There was a problem hiding this comment.
Sounds make sense, but the previous code only runs once, so I think we can ignore this.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
Looks good, but since phase 4 mentions about react compiler compatibility, let's fix the |
|
@bernhardoj Both files are react compiler compatible, please let me know if you're getting any error.
|
|
PR doesn’t have any new product considerations as a code clean-up PR. Unassigning and unsubscribing myself. |


Explanation of Change
Fixed Issues
$ #79929
PROPOSAL:
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari