mirror of
https://github.com/penpot/penpot.git
synced 2025-06-02 00:51:38 +02:00
🐛 Fix incorrect error merging mechanism on form validation
This commit is contained in:
parent
e7a8c25883
commit
55ce9bef49
1 changed files with 6 additions and 1 deletions
|
@ -7,6 +7,7 @@
|
||||||
(ns app.util.forms
|
(ns app.util.forms
|
||||||
(:refer-clojure :exclude [uuid])
|
(:refer-clojure :exclude [uuid])
|
||||||
(:require
|
(:require
|
||||||
|
[app.common.data :as d]
|
||||||
[app.common.spec :as us]
|
[app.common.spec :as us]
|
||||||
[app.util.i18n :refer [tr]]
|
[app.util.i18n :refer [tr]]
|
||||||
[cljs.spec.alpha :as s]
|
[cljs.spec.alpha :as s]
|
||||||
|
@ -69,11 +70,15 @@
|
||||||
(::s/problems (s/explain-data spec (:data state))))
|
(::s/problems (s/explain-data spec (:data state))))
|
||||||
|
|
||||||
errors (reduce interpret-problem {} problems)
|
errors (reduce interpret-problem {} problems)
|
||||||
|
|
||||||
|
|
||||||
errors (reduce (fn [errors vf]
|
errors (reduce (fn [errors vf]
|
||||||
(merge errors (vf errors (:data state))))
|
(merge errors (vf errors (:data state))))
|
||||||
errors
|
errors
|
||||||
validators)
|
validators)
|
||||||
errors (merge errors (:errors state))]
|
errors (merge (:errors state) errors)
|
||||||
|
errors (d/without-nils errors)]
|
||||||
|
|
||||||
|
|
||||||
(assoc state
|
(assoc state
|
||||||
:errors errors
|
:errors errors
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue