Update the input whenever the draft is updated#84844
Update the input whenever the draft is updated#84844arosiclair merged 2 commits intoExpensify:mainfrom
Conversation
|
@dukenv0307 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3c5d6c9227
ℹ️ 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".
src/components/Form/FormProvider.tsx
Outdated
| } | ||
| if (!isLoadingDraftValues && draftValues !== previousDraftValues.current) { | ||
| previousDraftValues.current = draftValues; | ||
| setInputValues({...draftValues}); |
There was a problem hiding this comment.
Preserve non-draft fields when applying draft updates
Replacing inputValues with only draftValues drops any fields that intentionally do not persist to Onyx drafts. In forms that mix draft and non-draft inputs (for example AdditionalDetailsStep, where ssn does not set shouldSaveDraft), editing a draft-backed field triggers this path and clears the in-memory non-draft value on the next render. This is a regression from the previous behavior (which only hydrated once after load) and can cause users to lose entered data mid-form.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Hmm this sounds plausible. Let's combine both draft and input values to address this - setInputValues({...inputValues, ...draftValues}))?
There was a problem hiding this comment.
Make sense. Updated
trjExpensify
left a comment
There was a problem hiding this comment.
Haha, what a weird bug! 👍
|
Ready for your review @dukenv0307 |
|
on it now |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-03-12.at.10.15.38.movAndroid: mWeb ChromeScreen.Recording.2026-03-12.at.10.06.47.moviOS: HybridAppScreen.Recording.2026-03-12.at.10.16.25.moviOS: mWeb SafariScreen.Recording.2026-03-12.at.10.03.14.movMacOS: Chrome / SafariScreen.Recording.2026-03-12.at.10.01.11.mov |
|
🚧 @arosiclair 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/arosiclair in version: 9.3.37-0 🚀
|
|
Deploy Blocker #85331 was identified to be related to this PR. |
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.3.37-10 🚀
|
Explanation of Change
Fixed Issues
$ #84475
PROPOSAL:
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
Precondition: Workspace is connected to NetSuite
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
web.mp4