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

Add support for passing errors to HasManyFields component #377

Merged
merged 1 commit into from
Apr 5, 2018

Conversation

choruk
Copy link
Contributor

@choruk choruk commented Apr 4, 2018

No description provided.

@@ -108,6 +110,7 @@ class HasManyFields extends React.Component {
>
<Template
value={item}
errors={errors[i]}
Copy link
Contributor

Choose a reason for hiding this comment

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

Just double-checking that if we don't use errors, this will not pass errors to child components that don't support errors prop

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if I misunderstood, but if the child components don't support errors prop, then this will just be ignored. Or do you mean we should only pass errors along to the child components if errors prop was actually passed in to the HasManyFields component?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sort of, otherwise you'll get prop errors in console.
But in this case, if no errors are specified, the errors prop will be passed undefined, which I think is okay

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea that was my thinking. If no errors prop is specified, the prop will be passed as undefined, which I believe React treats as not having the prop passed at all. If errors are specified, then the prop will get passed with an actual value, but I imagine people would only pass in errors if their template supports that prop

Copy link
Contributor

@gthomas-appfolio gthomas-appfolio left a comment

Choose a reason for hiding this comment

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

LGTM, one question inline

@gthomas-appfolio gthomas-appfolio merged commit 43a0990 into master Apr 5, 2018
@gthomas-appfolio gthomas-appfolio deleted the ngAddHasManyFieldsErrors branch April 5, 2018 20:01
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