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

Adding support for dynamic update methods. #6

Merged
merged 4 commits into from
Mar 19, 2018

Conversation

swernerx
Copy link
Contributor

@swernerx swernerx commented Mar 6, 2018

This adds the possibility to use the "updates" field as a method for dynamically returning fields to update instead of just allowing a static list. It makes the whole package much for interesting when used in combination with final-form-arrays.

I also added a new test case to cover the new functionality.

Other tests and linting are looking good as well.

Fixed #5

@swernerx swernerx changed the title Adding support for dynamic update methods. Fix for issue #5. Adding support for dynamic update methods. Mar 6, 2018
@codecov
Copy link

codecov bot commented Mar 6, 2018

Codecov Report

Merging #6 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master     #6   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           1      1           
  Lines          21     25    +4     
  Branches        3      4    +1     
=====================================
+ Hits           21     25    +4
Impacted Files Coverage Δ
src/decorator.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8de217b...d97b4dc. Read the comment docs.

src/decorator.js Outdated
const update = updates[destField]
form.change(destField, update(next, values))
})
if (updates instanceof Function) {
Copy link
Member

Choose a reason for hiding this comment

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

@swernerx
Copy link
Contributor Author

swernerx commented Mar 7, 2018

Adjusted for using typeof.

@erikras
Copy link
Member

erikras commented Mar 7, 2018

Can you update both types.js and the README?

@swernerx
Copy link
Contributor Author

swernerx commented Mar 7, 2018

I updated the readme. Unfortunately, I don't have enough experience with Flowtype to make the adjustment. Can you handle this?

@swernerx
Copy link
Contributor Author

Hi Erik, I'm unsure - I don't want to put you under any pressure. It would be great, though, you could take over and release a new release. Thank you :)

@erikras
Copy link
Member

erikras commented Mar 11, 2018

I can do it. Just gotta get around to it. 😄

@eddsreal
Copy link

Hi all ! how can i get this feature ?

@erikras erikras merged commit 6c79245 into final-form:master Mar 19, 2018
@erikras
Copy link
Member

erikras commented Mar 20, 2018

Published fix in v1.1.0.

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.

3 participants