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
V5 new feature: remove array field by predicate function #3739
Conversation
@danikkks this commits are already merged here - #3382 |
@@ -0,0 +1,4 @@ | |||
export default (value) => { |
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.
why don't you use the isFunction from loadash?
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.
v5 of redux-form don't include lodash as dependency
src/reducer.js
Outdated
@@ -79,10 +80,20 @@ const behaviors = { | |||
[INITIALIZE](state, {data, fields, overwriteValues}) { | |||
return createInitialState(data, fields, state, overwriteValues); | |||
}, | |||
[REMOVE_ARRAY_VALUE](state, {path, index}) { | |||
[REMOVE_ARRAY_VALUE](state, {path, indexOrPredicate}) { |
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.
suggestion: it would be better if the param 'indexOrPredicate' would split into 2 different params, the first 1 is 'index' and the second is 'predicate', and the logic is basically the same.
when you check isFunction the indexOrPredicate, you'll check if (predicate && isFuncion(predicate))
the reason for the split is to keep Single Responsibility, each param should have only 1 purpose, and the word 'or' applies that this param have 2 different purposes
it's just a suggestion :)
DONE! |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Published in |
solution for this feature request - #3738