-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Prevent picker onInputChange firing on re-render #11120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
dangrous
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey so this is working for me but I have one quick question before approving:
Will this cause any issues if we ever have a window with multiple pickers that can have the same value? Wouldn't they then have the same key if they have the same value?
That's a great question to bring up! Thanks. I looked into it and according to the docs here keys only have to be unique among the children, not globally. Therefore I think this is fine because pickers shouldn't have duplicate values. Here are the more general docs on keys. Also I'm taking this off of hold now that the Web-PR is on staging. Please review and fill out the checklist when you have a moment. |
PR Reviewer ChecklistThe Contributor+ will copy/paste it into a new comment and complete it after the author checklist is completed
|
|
@neil-marcellini looks like this was merged without passing tests. Please add a note explaining why this was done and remove the |
|
All checks passed. I had to manually re-run the author checklist but not the reviewer checklist. |
|
✋ 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 @neil-marcellini in version: 1.2.12-0 🚀
|
|
Dropping a note that there was a regression: the blue outline persists on dropdown inputs even after focusing on another input. We're fixing it by reverting this PR in #11039 (comment) |
|
Thanks @rushatgabhane, sorry for introducing that regression! I can do an RCA. Would you please explain why setting the key here causes the blue outline to persist? |
I don't think you need to? Because it didn't make it to production, and was caught by QA #11646 |
|
Oh good I misread, thanks! |
@neil-marcellini maaaaybe passing a I don't know, but it's an interesting bug. |
|
🚀 Deployed to production by @AndrewGable in version: 1.2.12-4 🚀
|
Prevent picker onInputChange firing on re-render
Details
On the
ReportSettingsPagewe update the notification preference as soon as the user changes the value of the picker. However,onInputChangewas also triggering when the component updated after the room name was updated. To prevent that I have added a key prop so that it only updates when the actual value changes. I got the idea from this GH issue.App/src/pages/ReportSettingsPage.js
Lines 198 to 204 in 60cf2f7
Fixed Issues
$ #10437
Tests
Check out the branch from https://github.com/Expensify/Web-Expensify/pull/34897 for the backend Web-E changes.
PR Review Checklist
Contributor (PR Author) Checklist
### Fixed Issuessection aboveTestssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*filesSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */displayNamepropertythisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)Avataris modified, I verified thatAvataris working as expected in all cases)PR Reviewer Checklist
The Contributor+ will copy/paste it into a new comment and complete it after the author checklist is completed
### Fixed Issuessection aboveTestssectionQA stepssectiontoggleReportand notonIconClick).src/languages/*filesSTYLE.md) were followedAvatar, I verified the components usingAvatarhave been tested & I retested again)/** comment above it */displayNamepropertythisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)Avataris modified, I verified thatAvataris working as expected in all cases)QA Steps
Same as tests.
Screenshots
Web
Mobile Web
iOS / Safari

Android / Chrome

Desktop
iOS
Android