Fork me on GitHub
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.


@ericihli this is in RAD’s numeric ns:

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

🙏 3
Eric Ihli18:07:41

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


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


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


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


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


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


so, no ident, no location, no worky work


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


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


: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)])


I am pretty sure the ident is alright 😉


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


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?


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


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


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


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


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