Closed kabilansakthivelu closed 1 week ago
Latest commit: 6b0e6333ee8ec6cb2fdaf3b12437d31552be43be
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
@kabilansakthivelu selected IN first and everything worked as expected, changed country from IN to Pakistan or any other in general, cities and state dropdown doesn't work.
Hi @RgnDunes, the above mentioned behaviour is because, we are not triggering getStates call when Pakistan is selected as it does not have States classification and only has Provinces system.
Currently in Prod also, we are not making a call to fetch States for Pakistan but the fetched states for previous country was not cleared leading to mismatch between the states displayed for a country selected.
As part of this PR, made changes to clear the previously fetched info whenever parent field value changes.
Please refer the below image for the states displayed for country Pakistan in Prod currently (previously selected country - India). Thanks
Description
Changes Made
List the main changes made in this pull request.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Additional Notes
Default selected city on state change:
onChange for city field:
getCities
andgetZipcodes
where state is selected, and when country is changed fromIndia
toAfghanistan
(which does not have any states division), then the field options for State, Cities and also Zipcodes fields were not cleared. UpdateduseEffect
to reset the child field options and value on parent field value change.When child field value and options were not cleared after parent field value change:
When child field value and options were cleared after parent field value change:
Checklist:
Reviewer Checklist
PR Title Format
Format:
<type>: <subject>
Types can be as follows:
feat
: (new feature for the user, not a new feature for build script)fix
: (bug fix for the user, not a fix to a build script)docs
: (changes to the documentation)style
: (formatting, missing semi colons, etc; no production code change)refactor
: (refactoring production code, eg. renaming a variable)test
: (adding missing tests, refactoring tests; no production code change)chore
: (updating grunt tasks etc; no production code change)