This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-21
Channels
- # calva (11)
- # cider (4)
- # clojure (15)
- # clojure-europe (20)
- # clojurescript (14)
- # clr (45)
- # conjure (2)
- # cursive (1)
- # fulcro (10)
- # helix (4)
- # honeysql (7)
- # hoplon (21)
- # humbleui (2)
- # hyperfiddle (23)
- # introduce-yourself (1)
- # malli (11)
- # matrix (3)
- # off-topic (6)
- # pathom (2)
- # practicalli (1)
- # re-frame (9)
- # releases (1)
- # specter (2)
- # sql (10)
- # xtdb (2)
Hi all. Not exactly a Fulcro question, but might just be something I'm missing as a setting. Data coming back from Pathom via transit has tagged literals, #f and #uuid, is there a way in Fulcro to convert this? Getting values like: #object[Transit$TaggedValue [TaggedValue: f, 10.000000000000000000000000000000]] Not sure how to render this to screen
Got this working using the following. Is the the best method?
:response-middleware (http/wrap-fulcro-response
(fn [r] r)
{"f" f-tag-read-handler})
No. Uuid float and such are built into transit. Did you set things up the way shown in book and templates? If you need a custom handle you can install it fulcro-wide as well. Seehttps://book.fulcrologic.com/#_custom_type_support
f is for bigdecimal. That is handled automatically by transit itself. If you send a bigdecimal from the server, then you will get it on the client (as you should). If you’re using RAD then it comes with code the supports these in js (using Big.js), and the utilities I’ve written help you deal with them directly. See https://cljdoc.org/d/com.fulcrologic/fulcro-rad/1.0.7/api/com.fulcrologic.rad.type-support.decimal
Thank you @U0CKQ19AQ, going to go back and see if I misconfigured somewhere. On the server I am using Pathom3. It's serving a different client, so I'm a bit stuck with v3. Not sure if that has something to do with it. I'm not using RAD yet, but plan on it once I have a better grasp of Fulcro
it’s just that you’re getting the raw transit bigdecimal https://github.com/cognitect/transit-cljs#default-type-mapping
even in RAD I leave them as cognitect representations. I just do calculations using big.js
for example: https://github.com/fulcrologic/fulcro-rad/blob/fulcro-rad-1.0.7/src/main/com/fulcrologic/rad/type_support/decimal.cljc#L161 the math operators convert the ct bigdec into Big, then do math, then convert it back. So that the data rep in Fulcro is always the transit-compatible value.