razorpay / i18nify

One stop solution for all your internationalisation needs.
https://geosmart.razorpay.com/
21 stars 10 forks source link

fix: geo location dropdown bugfixes in playground #181

Closed kabilansakthivelu closed 1 week ago

kabilansakthivelu commented 1 month ago

Description

Changes Made

List the main changes made in this pull request.

Title ---
JIRA link NA
Slack thread (if any) NA
Product spec NA
Tech spec/One-pager NA
Bundle Size Difference NA
Fixes Issue NA

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

  1. In playground, onChange prop is passed to Cities and Zipcodes dropdown, so that the selected value in the respective dropdown field will get updated.

Default selected city on state change:

Screenshot 2024-10-24 at 20 02 35

onChange for city field:

Screenshot 2024-10-24 at 20 02 49
  1. In playground, for getCities and getZipcodes where state is selected, and when country is changed from India to Afghanistan (which does not have any states division), then the field options for State, Cities and also Zipcodes fields were not cleared. Updated useEffect 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:

Screenshot 2024-10-24 at 20 10 25

When child field value and options were cleared after parent field value change:

Screenshot 2024-10-24 at 20 10 48
  1. Added placeholder content to geo location dropdown fields, if no records are available.
Screenshot 2024-11-15 at 18 09 32

Checklist:

Reviewer Checklist


PR Title Format

Format: <type>: <subject>

Types can be as follows:

changeset-bot[bot] commented 1 month ago

⚠️ No Changeset found

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.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

RgnDunes commented 2 weeks ago
Screenshot 2024-11-14 at 12 19 21 PM

@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.

kabilansakthivelu commented 2 weeks ago

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

Screenshot 2024-11-14 at 14 03 27