Fork me on GitHub
#fulcro
<
2020-07-29
>
Eric Ihli17:07:03

I saw something in a Fulcro video or docs or something about BigDecimals not being printable to console. I think it was related to a math.cljc file, something in Fulcro RAD. I don't remember if it was just a comment or if there was a solution, like overriding a method on them or something. I'm working with them a lot now and I'm annoyed at having to call toString or do a conversion every time I want to log one to debug something, so I'm wondering if there was a better way.

tony.kay18:07:01

@ericihli this is in RAD’s numeric ns:

#?(:cljs
   (extend-protocol IPrintWithWriter
     ty/TaggedValue (-pr-writer [d writer opts]
                      (let [t    (.-tag d)
                            v    (.-rep d)
                            type (case t
                                   "f" "bigdec"
                                   "n" "bigint"
                                   "tagged")]
                        (-write writer (str "#" type " \"" v "\""))))))

🙏 3
Eric Ihli18:07:41

Thanks! I think that's exactly what I was looking for.

tony.kay18:07:31

and should cause prints of tagged values (transit types) to print

Adrian Smith08:07:01

Is it possible to get this on YouTube? I suspect the zoom recording will expire once the cloud storage exceeds its limits

lgessler00:07:15

if somebody wants to upload it i'm happy to give them the raw file

zilti19:07:49

So this singleton component... depending on where I use it, I get "ui/set-props requires component to have an ident" errors.

tony.kay19:07:16

you cannot use set-value! and such helpers in a component without an ident

tony.kay19:07:35

those helpers use the mutation env to figure out the ident of the component to know where to store state

tony.kay19:07:47

so, no ident, no location, no worky work

tony.kay19:07:24

perhaps you’ve mis-written your ident? If it is a true singleton, the ident must be a lambda. Other values are “magic”

tony.kay19:07:38

:ident (fn [] [:component/id ::my-thing]) is the ident of a singleton

tony.kay19:07:17

:ident [:a :b] is shorthand for “the table will be :a, and the ID key for entities in the props is :b”, and translates to (fn [] [:a (:b props)])

zilti19:07:14

I am pretty sure the ident is alright 😉

zilti19:07:16

The factory is (def ui-one-click-intro-form (comp/factory OneClickIntroForm)) and the components embedding it have {:introform (comp/get-query introduction-forms/OneClickIntroForm)} in their query and use it as (introduction-forms/ui-one-click-intro-form (:introform props)} which works fine on the component where I always did that, but on that other it fails with the mentioned error

zilti19:07:22

I think it likely is because I am using the parent component as top-level component in InitialRouting and thus its props aren't properly initialized?

zilti20:07:37

I have no idea how to initialize the props/query inside a defrouter

tony.kay20:07:09

you don’t. It does that for you (and for its targets). You do have to compose IT with its parent

zilti20:07:50

Well no, it doesn't, because it is a component inside the defrouter component, wrapping the route-factory call

zilti20:07:33

It is a sidebar, and the code is (ui-sidebar {:items sidebar-items :content (route-factory route-props)}) and so the sidebar props will be just this map with these two keys

zilti20:07:41

Even though it'd need a third one for the child component: