Skip to content

Fix for issue magento/magento2#18630 #18633

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions app/code/Magento/Ui/view/base/web/js/form/element/post-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,26 @@ define([
}
},

/**
* Initializes observable properties of instance
*
* @returns {Abstract} Chainable.
*/
initObservable: function () {
this._super();

/**
* equalityComparer function
*
* @returns boolean.
*/
this.value.equalityComparer = function (oldValue, newValue) {
return !oldValue && !newValue || oldValue === newValue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to change comparator behavior to achieve

the compare on the frontend is breaking because NULL != " "

?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It exactly says what it is for. We get a NULL value, which is not the same as "". So that's why we need this change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dverkade I mean this looks like kinda low-level change. Is there some other place in client code which may be adjusted instead of changing comparator behavior?

};

return this;
},

/**
* @param {String} value
*/
Expand Down