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
Show validation errors to user when creating a new form #1308
Conversation
dd1897f
to
c647994
Compare
@@ -27,20 +28,32 @@ | |||
(map key-to-id) | |||
(str/join "-"))) | |||
|
|||
(defn- get-error [context keys] | |||
(when (:get-form-errors context) | |||
(let [form-errors @(rf/subscribe [(:get-form-errors context)])] |
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 would prefer that the component contains the subscription and not a random function that gets called. You could give the form-errors
as parameters into this fn. In this case the subscription is duplicated into the call sites but at least it's more obvious that the component requires data.
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.
Done
|
||
(fn [{:keys [db]} [_ request]] | ||
(let [form-errors (validate-form (db ::form) (db :languages))] | ||
(when (nil-vals? form-errors) |
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 would try to restructure the data so that this condition can be a plain empty?
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.
Done, good suggestion, I think it's better now
closes #1292