Skip to content

Instantly share code, notes, and snippets.

@currentoor
Created August 21, 2017 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save currentoor/4241bb09de5293014e8633ff4e3ee6a5 to your computer and use it in GitHub Desktop.
Save currentoor/4241bb09de5293014e8633ff4e3ee6a5 to your computer and use it in GitHub Desktop.
(defmacro defmutation2
[dispatch with-sym policy params & args]
`(fulcro.server/defmutation ~dispatch ~params ~@args))
(defmacro defmutation3
[dispatch with-sym policy params [action-sym env & action-body]]
`(fulcro.server/defmutation ~dispatch ~params
(~action-sym ~env
~@action-body)))
[(macroexpand-1 '(defmutation2 schedule/edit with policy
[params]
(action [env]
env)))
(macroexpand-1 '(defmutation3 schedule/edit with policy
[params]
(action [env]
env)))]
=> [(fulcro.server/defmutation schedule/edit [params] (action [env] env))
(fulcro.server/defmutation schedule/edit [params] (action [env] env))]
(defmutation2 schedule/edit with policy
[params]
(action [env]
env))
=> #multifn[server-mutate 0x4c42265f]
(defmutation3 schedule/edit with policy
[params]
(action [env]
env))
ExceptionInfo In: [2] val: (action [env] env) fails spec: :fulcro.server/mutation-args at: [:action] predicate: (and (list? %) (= (quote action) (first %)))
:clojure.spec.alpha/spec :fulcro.server/mutation-args
:clojure.spec.alpha/value (schedule/edit [params] (action [env] env))
clojure.core/ex-info (core.clj:4617)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment