Fork me on GitHub
#fulcro
<
2018-05-12
>
Pontus15:05:58

Hello! I'm migrating an app from om-next to Fulcro. It's been a very smooth process so far but there's one thing I've got trouble understanding how to do. Is there any way I can control how the fulcro.client.data-fetch/load should merge the response into the state? From the server I'm returning this response:

{:status 200 :body {:data 
                    {:notes [{:db/id 1, :note/content "some content of the note" ... ], 
                     :notebooks [{:db/id 2, :notebook/title "a title"} ...]}
I solved it in om-next by doing this in the callback to the send function that was passed to the reconciler:
(let [{:keys [data] :as response} (->> (.getResponseText this)(t/read (om/reader)))
              {:keys [rewrite]} (om/process-roots data) ]

          (callback (rewrite data)))))
I've got the correct response coming from the server, but I don't know how to merge it. So far I've tried like this but it merges the result under :data
(defonce app                                                                                                                                                                                                  
   (atom (fc/new-fulcro-client :started-callback                                                                                                                                                                
                              (fn [app]                                                                                                                                                                                                                                                                                                                                                                     
                                (df/load app :data Root)                                                                                                                                                                                                                                                                                                                                                                      
                                (df/load app :notes Root {:target [:notes]})                                                                                                                                                                                                                                                                  
                              ))))  

OliverM21:05:08

I'm migrating a fulcro project to use shadowbuild instead of figwheel. I'm doing it by comparing my setup to a default lein new fulcro shadowcljs demo project, and copying code across (renaming the namespaces as I go). This seems to have gone well except for internationalisation support - both lein and shadowcljs complain about ::i18n namespaced keywords, like (for shadow-cljs):

adaptdb/ui/root.cljc [line 41, col 41] Invalid keyword: ::i18n/current-locale.
or for lein:
adaptdb/ui/root.cljc [line 41, col 41] Invalid keyword: ::i18n/current-locale.
Am I missing a file or config setting somewhere? The devcards build is compiled without issue as it has no i18n in it, it's just the main build that causes issues.