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

[Form] Fixes "remove rule(field)" throw exception if field has no rules #6940

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

[Form] Fixes "remove rule(field)" throw exception if field has no rules #6940

wants to merge 1 commit into from

Conversation

jameschenjav
Copy link

Closed Issues

#5745

Description

remove rule(field, rules) should remove all rules when argument rules is omitted. But field may not have any rules, and it would raise exceptions because of validation[field].rules = [].

There is some guard code to check if validation[field].rules exists, but the order is wrong apparently.

Testcase

https://jsfiddle.net/whd3o60j/3/

Click "Remove All Validations", raised exception Uncaught TypeError: Cannot set property 'rules' of undefined (in Chrome)

visit `rules` on undefined `validation[field]`
@lubber-de

This comment was marked as spam.

@jameschenjav
Copy link
Author

hi @lubber-de
i noticed semantic-ui repo stopped updating after i created this PR and mentioned it to our dev team.
i suggested to our team after saw your comment, and today we've decided to adopt fomantic-ui for further upgrades.
thanks for the great work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants