Fork me on GitHub
#cljsrn
<
2023-02-06
>
Abdel01:02:38

Hi all, I'm stuck with this problem .. and need some help please I'm using realm from Js side to fetch some tasks objects , from console log everything seems fine. but this is how my db looks like from re-frisk ..

tasks {1 keys} ⎘
":2"[TaggedValue: ForeignType, ]

dima09:02:38

@U01D1CZKK6K i'm not sure i understand the issue well.

dima09:02:55

Is it

[TaggedValue: ForeignType, ]
that look unfamiliar?

Abdel00:02:40

yeah @U051091NM that's unfamiliar to me I guess if i know what i means i will be able to fix it

hadils09:02:39

Hi @U01D1CZKK6K. Re-frisk is showing that a native JS type is in the database, not a cljs type. Try js->clj in your code to convert the type.

2
Abdel03:02:39

Hi @UGNMGFJG3.. I already had that 😕 but it didn't fix it for me ... this is how my code looks like

(reg-cofx
 :tasks-storage
 (fn [cofx _]
   (let [tasks (js->clj (get-all- 
                          tasks))]
    (assoc cofx :tasks-storage tasks))))

(rf/reg-event-fx
 :initialize-db
 [(rf/inject-cofx  :tasks-storage)]
 (fn [{:keys [db tasks-storage]}]
   {:db (or (when-not (empty? tasks-storage) (assoc initial-state :tasks tasks- storage))
                    initial-state)}))

hadils16:02:01

It is a nested JS structure. You need to extract the body of the js map and build the cljs map by hand.

👍 2
Abdel16:02:56

I will give it a try .. I thought js->clj handles nested structures