Fork me on GitHub
#reagent
<
2018-01-23
>
achikin11:01:36

Hi! I have issues using multimethods as components

achikin11:01:43

Consider this

achikin11:01:01

It's a little bit oversimplified, but the idea is that value only got dereferenced once and than never changes.

achikin11:01:41

Looks like reagent is not able to treat multimethods as components.

achikin11:01:59

Did anyone come across this and what is the best way to overcome it?

noisesmith12:01:10

my hunch is that it's because multimethods are not fn?

+user=> (defmulti foo identity)
#'user/foo
+user=> (fn? foo)
false

noisesmith12:01:01

which means the simplest workaround is to use (fn [& args] (apply foo args)) which is fn? and that should dispatch properly

noisesmith12:01:32

as an aside I spent too long confused by your defmethod until I realized it was missing the multifn

achikin15:01:26

Yes, but (ifn? foo) => true

achikin15:01:23

So they do exactly what you suggested inside the reagent already/

fabrao15:01:52

Hello all, I used the https://github.com/reagent-project/reagent-template and I finished it. So, is there any way to use it as a .jar to deploy to customer?

fabrao15:01:31

I don´t know after generate .jar, starting it browser tell that can´t find css files

fabrao15:01:50

doing lein uberjar

noisesmith16:01:34

are you using wrap-resource or wrap-file?

noisesmith18:01:47

the problem with wrap-file is that when you make an uberjar, the file doesn't exist on disk, if you change that to wrap-resource it will still find that resource inside the jar