Fix: resetting the country/state picker when it is reopened#24023
Conversation
|
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
|
Looking through FORMS.md, I don't think there's anything that we need to update due to this PR |
| const updateSearchValue = useCallback((countries, currentValue) => { | ||
| setSearchValue(lodashGet(countries, currentValue, '')); | ||
| }, []); | ||
|
|
||
| useEffect(() => { | ||
| setSearchValue(lodashGet(allCountries, value, '')); | ||
| }, [value, allCountries]); | ||
| updateSearchValue(allCountries, value); | ||
| }, [value, allCountries, updateSearchValue]); |
There was a problem hiding this comment.
Why we are adding updateSearchValue as a new function? We should just call setSearchValue
There was a problem hiding this comment.
Thought it would be DRYer. Will change it.
|
@joh42 Please adjust the title of the PR to reflect the change. Also please remove the first video showing the bug it may be confusing. |
|
Updated, ready for another review @s77rt |
|
Please use the tests described below: (do same thing with state test)
|
|
👍 updated testing steps @s77rt |
Reviewer Checklist
Screenshots/VideosWebweb.mp4Mobile Web - Chromemweb-chrome.mp4Mobile Web - Safarimweb-safari.mp4Desktopdesktop.mp4iOSios.mp4Androidandroid.mp4 |
|
Please double check the state selector test steps |
|
Oh right, you actually don't need to select a country to use the state selector. Removing those 2 steps |
|
Updated again @s77rt |
|
@joh42 Thank you! |
|
✋ 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/MariaHCD in version: 1.3.50-0 🚀
|
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.3.50-3 🚀
|
|
🚀 Deployed to staging by https://github.com/MariaHCD in version: 1.3.51-0 🚀
|
|
🚀 Deployed to production by https://github.com/Julesssss in version: 1.3.51-2 🚀
|
Details
The values of the country/state pickers would remain cleared after reopening the picker
Please note: the state picker is broken in Storybook due to an issue with HeaderWithBackButton that I have reported here. This issue exists on staging. As suggested by Jack Nam I still marked the Storybook checkbox as completed, since that issue is not caused by this PR.
Fixed Issues
$ #23768
PROPOSAL: #23768 (comment)
Tests
Testing the country selector
Testing the state selector
Offline tests
Same as regular steps
QA Steps
Same as regular steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly 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)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
Web
Screen.Recording.2023-08-02.at.14.31.49.mov
Screen.Recording.2023-08-02.at.14.34.10.mov
Mobile Web - Chrome
Screen.Recording.2023-08-02.at.01.12.32.mov
Mobile Web - Safari
Screen.Recording.2023-08-02.at.00.45.06.mov
Desktop
Screen.Recording.2023-08-02.at.00.33.48.mov
Screen.Recording.2023-08-02.at.00.34.11.mov
iOS
Screen.Recording.2023-08-02.at.00.38.07.mov
Android
Screen.Recording.2023-08-02.at.01.18.23.mov