Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
;; example for novelty:
{:user/verify {:db/id 1234 :being-verified false :verification-error :credentials-invalid}}
(defn merge-tree [old-state novelty]
(:user/verify novelty)
(let [novelty-props (:user/verify novelty)]
(update-in old-state [:users/by-id (:db/id novelty-props)] merge (dissoc novelty-props :db/id)))
(map? old-state)
(merge old-state novelty)
(defmethod mutate 'user/verify
[{:as env :keys [ref state reconciler]} _ _]
{:value {:keys [:users/list]} ;; problably not needed, users have Ident
:action #(swap! state update-in ref merge {:being-verified true}) ;; triggering local change
:rest-remote true}) ;; response gets merged into app-state, but no re-rendering is triggered
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment