-
-
Notifications
You must be signed in to change notification settings - Fork 32
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 setting / modifying all fields of a form at once #35
Conversation
…ll functions. Broke something...
… its purpose and function.
…d unwrap* helpers.
. Query pq cq cs form m Unit | ||
-> Query pq cq cs form m Unit | ||
-> Query pq cq cs form m Unit | ||
andThen_ a b = AndThen a b unit |
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.
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.
I'm just playin
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.
Just absolutely ludicrous. The sort of thing I'd expect from @crcornwell. How did you even find that?
I'm not sure if I missed something, but I couldn't find
|
@dariooddenino 🤦♂️ I didn't include it as I was working because you could easily do it with the code you wrote above. But then I forgot to include the query helper at the end, which would simply combine the two like that! setValidateAll_ fields = andThen_ (setAll_ fields) validateAll_ |
What does this pull request do?
Solves #31 by adding
SetAll
andModifyAll
queries, so a user can provide a new set of input values to overwrite the current ones, or a new set of input functions to modify existing inputs.In addition, Formless now exports query / action functions for every query, instead of only the
modify
/validate
variants, so a user can useF.setAll_
,F.reset_
, etc, and adds documentation for each one. This is because a) it's necessary to provide some helpers for creating queries for things likeModify
which require injecting a variant; and b) there are more helper queries than actual queries in the component, to keep the component simpler. There was also some confusion in Slack recently over why some queries were just data constructors and others were functions.Other Notes:
As implemented, I require that you use
wrapInputFields
orwrapInputFunctions
to wrap your new record of inputs / input functions rather than supply a plain record. This is due to needing to prove that you are providing aform Record InputField
orform Record InputFunction
that is identical to the current form in the component.Example: