diff --git a/src/schema/state.cljs b/src/schema/state.cljs index 86731ef224f0..cd46cc64a42b 100644 --- a/src/schema/state.cljs +++ b/src/schema/state.cljs @@ -5,3 +5,7 @@ "Set of schema identifiers, usually namespaced keywords. When the set is empty, no schema errors will be displayed on the app. See `schema.view/view`." (reagent/atom #{})) + +(defn clear-errors + [] + (reset! errors #{})) diff --git a/src/schema/view.cljs b/src/schema/view.cljs index 2634c92220ac..6ff2c1074cd2 100644 --- a/src/schema/view.cljs +++ b/src/schema/view.cljs @@ -8,13 +8,11 @@ (defn view [] - (let [on-press #(reset! schema.state/errors #{})] - (fn [] - (when (seq @schema.state/errors) - [rn/pressable - {:on-press on-press - :style (style/container {:bottom-inset (safe-area/get-bottom)})} - [quo/icon :i/close {:size 12 :color "#ddd" :container-style style/icon}] - [rn/text {:style style/text} - "Schema error(s)" - [rn/text {:style (merge style/text style/text-suffix)} " check logs"]]])))) + (when (seq @schema.state/errors) + [rn/pressable + {:on-press schema.state/clear-errors + :style (style/container {:bottom-inset (safe-area/get-bottom)})} + [quo/icon :i/close {:size 12 :color "#ddd" :container-style style/icon}] + [rn/text {:style style/text} + "Schema error(s)" + [rn/text {:style (merge style/text style/text-suffix)} " check logs"]]])) diff --git a/src/status_im2/setup/hot_reload.cljs b/src/status_im2/setup/hot_reload.cljs index 1d9ed56c2af9..38e83963b11f 100644 --- a/src/status_im2/setup/hot_reload.cljs +++ b/src/status_im2/setup/hot_reload.cljs @@ -22,7 +22,7 @@ (reset! label "reloading UI") (re-frame/clear-subscription-cache!) (schema/setup!) - (reset! schema.state/errors #{}) + (schema.state/clear-errors) (swap! cnt inc)) (defn before-reload