Repository navigation
Conversation
…nConfirm by splitting the latter into two separate functions
mikolajpochec
left a comment
There was a problem hiding this comment.
Great work! I think that this problem needs to be addressed though.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: decdcf0b90
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
I will address the review comments shortly, currently focusing on other high-priority project |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-09-09.at.4.56.32.PM.movAndroid: mWeb ChromeRecording_20260909_163235.mp4iOS: HybridAppScreen.Recording.2026-09-09.at.5.15.31.PM.moviOS: mWeb SafariScreen.Recording.2026-09-09.at.5.03.00.PM.movMacOS: Chrome / SafariScreen.Recording.2026-09-09.at.3.56.44.PM.mov |
|
Hey @marufsharifi anything left here? |
@marufsharifi addressed, thanks for the catch. The hook now clears the spinner one frame after the handler finishes if nothing took over. Note that on Please feel free to continue your review. One ask for the next pass. Looking back, the bugs from the last rounds all go back to the first version of the hook, not to the later fixes, so I'm a bit worried we'll keep finding them one at a time. Could you do a full sweep this time and put everything you find in one review, even small stuff? I'll fix it all in one go. |
|
🎯 @marufsharifi, thanks for reviewing and testing this PR! 🎉 A payment issue will be created for your review once this PR is deployed to production. If payment is not needed (e.g., regression PR review fix etc), react with 👎 to this comment to prevent the payment issue from being created. |
… improve comments
|
@rlinoz review addressed! |
|
@OlGierd03 is the perf test failing related? |
I don't think so. I'll merge main to re-run the check Edit: All green now 💚 |
3342c96 to
76ddd51
Compare
76ddd51 to
8cc5740
Compare
|
🚧 rlinoz has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/rlinoz in version: 9.5.24-1 🚀
|
|
No help site update is needed. This PR only changes when the loading spinner appears on buttons like Save. That is a loading-behavior detail, and it doesn't change any feature, label, or step described in the help articles. |
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.5.24-8 🚀
Bundle Size Analysis (Sentry): |
|
🤖 Payment issue created: #105314 |
Explanation of Change
Adds an opt-in immediate loading state to
ButtonComposed, so a press is acknowledged within a frame instead of after the handler's blocking work. The newshouldShowLoadingImmediatelyOnPressprop wraps the wholeonPress: Button commits a local pressed state, lets React paint the spinner, then runs the handler one macrotask later and hands over to the Onyx-drivenisLoading(where one exists) with no flicker. Turning it on is a one-line change at the call site.For handlers that validate or branch before doing the work, we use
usePressLoadingexplicitly, so the handler callsstartWithLoadingonly on the branch that actually starts work. A press that fails validation never calls run, so it shows no spinner and can't get stuck.The same mechanism already shipped for form submits in #92498, and the chart below shows why it's worth spreading: daily INP spans for [data-sentry-label="Form-SubmitButton"] fall from 1K to 1.7K to near zero at the 16 Jul deploy, with the badness score flatlining on the same date (the single badness spike on 14 Aug is an unrelated anomaly):
Sentry usually records only a session's single worst INP interaction, so each of those spans meant "submitting a form was the slowest thing this user did all session"; that stopped being true for thousands of sessions a week
Button hands
startWithLoadingtoonPressas a second argument, so a branching handler can spin only on the branch that starts work without wiring up its ownusePressLoading. That argument slot was already taken on selection lists, soConfirmButtonOptions.onConfirmis split intoonConfirm(event)for the selection and a newonConfirmFocusedOption(option)for the lists where confirming acts on a single row.Additionally,
ButtonContextis split into a state and an actions context (rulesdir/context-provider-split-values), since theonPresspublished to the primitives is now the wrapped handler.usePressLoadingitself now backs this Button-level wrapping (andFormProvider/FormAlertWithSubmitButton, which delegate their spinner to Button instead of owning a second instance). An undefinedisLoadingmeans there is no flag to hand over to, so the spinner clears as soon as the handler settles unless it navigated away, in which case the focus reset clears it on return and a synchronous in-flight guard ignores a second press landing before React commits the pressed state.Fixed Issues
#99659
Tests
Edit multiplein the selection menu.Edit multiple expensesRHP, open any field (e.g.Description), set a new value and pressSaveon the field page.Edit multiple expensespage, pressSave.Savethe instant it is pressed, before the RHP freezes/dismisses, and that it stays visible until the RHP is dismissed (no frame without the spinner).Additionally run the test steps from #92498 as well, since this PR reworks the
usePressLoadinghook and theFormProvider/FormAlertWithSubmitButtonflows that PR introduced. Verify none of them regress (spinner appears on press, clears after validation errors, never gets stuck after navigating back and a double press submits only once).Offline tests
N/A
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, 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.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Before:
before_1.mov
After:
after_1.mov