devcards icon indicating copy to clipboard operation
devcards copied to clipboard

defcard-rg without a name causes compilation error

Open green-coder opened this issue 6 years ago • 2 comments

Minimal code to reproduce:

(defn hello []
  [:div "hello"])

(defcard-rg
  [hello])

;; [Figwheel:SEVERE] java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Associative

I suspect that the problem is related to devcards.core/merge-options and macro expansion.

green-coder avatar Dec 30 '18 20:12 green-coder

I would like to propose to change the default value 'reagent-card used for the name, as it is likely that the user will use it by luck and run into unexpected behaviour - as I did.

'__reagent-card would be better.

Same remark for 'card -> '__card

green-coder avatar Dec 30 '18 20:12 green-coder

It appears that the compilation error is happening because of the assoc at https://github.com/bhauman/devcards/blob/master/src/devcards/core.clj#L154 which is applied onto unevaluated code from devcards.core/merge-options.

green-coder avatar Dec 30 '18 20:12 green-coder