cljsrn

Abdel 2023-02-06T01:42:38.033839Z

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, ]

dmitryn 2023-02-06T09:58:38.157289Z

@abourkia.ab i'm not sure i understand the issue well.

dmitryn 2023-02-06T09:58:55.174929Z

Is it

[TaggedValue: ForeignType, ]
that look unfamiliar?

Abdel 2023-02-07T00:04:40.291309Z

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

hadils 2023-02-07T09:41:39.647389Z

Hi @abourkia.ab. 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.

➕ 1
Abdel 2023-02-08T03:29:39.622359Z

Hi @hadilsabbagh18.. 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)}))

hadils 2023-02-08T16:20:01.359299Z

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

👍 1
Abdel 2023-02-09T16:11:56.283179Z

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

hadils 2023-02-09T16:27:06.279749Z

Depends