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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving unregistering metafields in metaforms.js #2812

Conversation

SamBauwensPM
Copy link
Contributor

@SamBauwensPM SamBauwensPM commented Jun 27, 2024

Description

Added the ability to unregister meta fields by name, templateUrl or a custom search predicate callback

We originally did that in a custom module of ours, and @EugeneOkhriemnko suggested I create a PR here so everyone can benefit.

Since there is no real method overloading in js, I did some _.isFunction magic to allow the same method ~group to accept the 3 different types of values for metaFieldToFind: name, function callback or object reference.

I added an error message because I think it's better t have an error than to silently not remove a field, but that could be considered a breaking change since the previous code didn't throw an error, if preferred this could be changed so that it only throws on error if metaFieldDescription, or not throw at all, or having this error throwing behaviour configured somewhere I don't know.

I tried to stay backwards compatible with the way unregisterMetaFields worked before, i.e it accepts an object reference in metaFieldToFind.

References

Sorry I have no idea what to put in this section.

QA-test:

Jira-link:

Artifact URL:

@CLAassistant
Copy link

CLAassistant commented Jun 27, 2024

CLA assistant check
All committers have signed the CLA.

@vc-ci
Copy link
Contributor

vc-ci commented Jun 27, 2024

Reveiw task created: https://virtocommerce.atlassian.net/browse/VCST-1448

@artem-dudarev artem-dudarev changed the base branch from dev to VCST-1448 July 1, 2024 10:39
@artem-dudarev artem-dudarev merged commit e636c0b into VirtoCommerce:VCST-1448 Jul 1, 2024
7 checks passed
@SamBauwensPM SamBauwensPM deleted the feature/metaform-service-unregister-methods branch July 1, 2024 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants