Fork me on GitHub
#fulcro
<
2018-09-15
>
pvillegas1212:09:12

When receiving responses from a datomic-backed server, the db/id are large numbers such as 44143192831950917. Looks like fulcro is converting them into goog.math.Long under the hood. The problem is that when I use the bidi-based routing it does not know how to handle those goog.math.Long

No protocol method ParameterEncoding.encode-parameter defined for type object: 46157498134036548
Is there a way to convert these into strings when received after a load?

claudiu14:09:09

@pvillegas12 you can convert load data with a post-mutation.

tony.kay16:09:33

depending on what you’re doing

tony.kay16:09:01

I’m not sure where that error is coming from

tony.kay16:09:16

Fulcro uses transit. See the conversion table here: https://github.com/cognitect/transit-cljs

tony.kay16:09:37

you need to extend that protocol

pvillegas1216:09:01

@tony.kay I’m using the datomic generated ids in my fulcro UI. Those ids are used for routing, replacing the datomic payload with an initial-state one with the same data worked correctly (does not use the implicit conversion to goog.math.Long I suppose. I’ll look into extending the protocol

fiddlerwoaroof19:09:29

Any pointers for using the shadow-cljs version of the fulcro template with emacs?

fiddlerwoaroof19:09:20

It seems like I have to start both a lein nrepl connection and a shadow-cljs nrepl connection (in both clj + cljs mode) to get everything to work, is there anything more straightforward?

fiddlerwoaroof19:09:07

Cool, server/start! was the piece I was missing

fiddlerwoaroof19:09:39

lein with-profile +cljs repl
user> (go)
user> (require '[shadow.cljs.devtools.api :as shadow])
user> (require '[shadow.cljs.devtools.server :as server])
user> (server/start!)
user> (shadow/watch :main)

fiddlerwoaroof19:09:56

Now I just need to figure out how to duplicate that inside cider