Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting undefined when selecting valueType="short" on the Region Dropdown when selecting "Puerto Rico" country. As i checked there is an package called country-region-data there is no shortCode on some of the countries region https://github.com/country-regions/country-region-data/blob/master/data.json#L1 #137

Open
Imsatis opened this issue Sep 7, 2022 · 0 comments
Labels
Milestone

Comments

@Imsatis
Copy link

Imsatis commented Sep 7, 2022

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

Today I used patch-package to patch react-country-region-selector@3.6.1 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-country-region-selector/dist/rcrs.es.js b/node_modules/react-country-region-selector/dist/rcrs.es.js
index 3294dc7..a79e2d7 100644
--- a/node_modules/react-country-region-selector/dist/rcrs.es.js
+++ b/node_modules/react-country-region-selector/dist/rcrs.es.js
@@ -450,7 +450,7 @@ var RegionDropdown = function (_PureComponent) {
 				    _regionPair$split2 = slicedToArray(_regionPair$split, 2),
 				    regionName = _regionPair$split2[0],
 				    _regionPair$split2$ = _regionPair$split2[1],
-				    regionShortCode = _regionPair$split2$ === undefined ? null : _regionPair$split2$;
+				    regionShortCode = _regionPair$split2$ === undefined || _regionPair$split2$ === "undefined" ? regionName : _regionPair$split2$;
 
 				return { regionName: regionName, regionShortCode: regionShortCode };
 			});

This issue body was partially generated by patch-package.

@benkeen benkeen added the Bug label Aug 13, 2023
@benkeen benkeen added this to the 3.7.0 milestone Aug 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants