-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Fix #25350 - Some JS removes State/Province field for United Kingdom for example #25386
base: 2.4-develop
Are you sure you want to change the base?
Fix #25350 - Some JS removes State/Province field for United Kingdom for example #25386
Conversation
Hi @Bartlomiejsz. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
d7327fd
to
23cb887
Compare
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 @Bartlomiejsz, thanks for the contribution! I have trouble to understand the extensiveness of this change, I can see you are also refactoring helpers but was it really required to touch PHP files at all? I did some short debugging and following changes inside _updateRegion
method solved the issue for me and cleaned up the code a bit:
- Move
regionInput.val('');
belowif (this.options.regionJson[country]) {
as this clearing input field every time. - Extract
this._removeSelectOptions(regionList);
aboveif...else
because it is present in both of them anyway. - Remove
$(regionList).find('option:selected').removeAttr('selected');
as all the options are removed by the above call anyway.
Can you please check if those changes would be ok for you once you apply them? If so, feel free to update the PR.
Hi @krzksz, I'll check those changes as soon as possible, now only regarding php files being changed - this indeed wasn't required in terms of functional changes here and in first version of PR those were not modified. I modified those later to fix failing static tests ($this shouldn't be used in phtml files) |
Hi @krzksz, I applied changes you requested, please review :) |
app/code/Magento/Checkout/view/frontend/web/js/region-updater.js
Outdated
Show resolved
Hide resolved
Hi @krzksz, you're right, added this one change. I also noticed one additional issue, if you select some country which have regions list as select (i.e. USA), select one of regions, then switch to another country with also regions select (like Poland). Then Region select becomes empty (even without default message to choose option). I modified then saving of current region in same manner as introduced in this PR for text input - per country. |
Hi @krzksz, thank you for the review.
|
@engcom-Bravo Done. |
Hello @Bartlomiejsz. Thank You for Your contribution. In order for us to be able to further process Your PR please cover it with the appropriate auto-tests. Thank You. |
Hi @engcom-Bravo, sorry but what exactly should be covered with tests here? In my previous PRs all javascript changes were marked as |
@magento run all tests |
004b155
to
b73e29e
Compare
Hi @krzksz, since #26285 introduced ViewModel used for similar goal that I achieved with one created here, and both changes together resulted in conflicts, I rebased my changes onto 2.4-develop and instead of creating my own ViewModel I used one created in mentioned PR. Please review again if possible |
@Bartlomiejsz this branch has conflicts that must be resolved |
b73e29e
to
b3ad17f
Compare
@ptylek done, resolved |
…ingdom for example
b3ad17f
to
c98f29e
Compare
Description (*)
This is fix for #25350
Fixed Issues (if relevant)
Manual testing scenarios (*)
Expected result (*)
Greater London is in the State/Province input
Questions or comments
Contribution checklist (*)