Fork me on GitHub
#figwheel-main
<
2021-09-22
>
niveauverleih05:09:09

Newbie here. Inspired by https://www.lucacambiaghi.com/posts/react-native-cljs.html i have converted a basic clock example from the https://reagent-project.github.io/ page to react native using figwheel.main: (ns fig.main (:require [reagent.core :as r] [reagent.react-native :as rrn] [clojure.string :as str])) (defonce timer (r/atom (js/Date.))) (defonce time-color (r/atom "#f34")) (defonce time-updater (js/setInterval #(reset! timer (js/Date.)) 1000)) (defn greeting [message] [rrn/text message]) (defn clock [] (let [time-str (-> @timer .toTimeString (str/split " ") first)] [rrn/view {:style {:color @time-color}} time-str])) (defn color-input [] [rrn/view "Time color: " [rrn/text-input {:type "text" :default-value @time-color :on-change #(reset! time-color (-> % .-target .-value))}]]) (defn hello [] [rrn/view {:style {:flex 1 :align-items "center" :justify-content "center"}$ [rrn/text "Hello world, it is now"] [clock] [color-input]]) (defn renderfn [props] (r/as-element [hello])) (defn figwheel-rn-root [] (renderfn {})) The repo is https://github.com/ronnac/clock-rrn. It runs fine when I run it in the expo web emulator with expo start --web after having applied the https://github.com/bhauman/figwheel-main/issues/304. However, when I build an apk with clj -m figwheel.main -O advanced -bo android and expo build:android -t apk and install I on my phone, it only shows:"waiting for figwheel to load files". I would have thought that figwheel removes itself from a production build? What am I doing wrong?

ccann22:09:28

I’m trying to debug a figwheel config on a legacy Om Next app. I’ve got things compiling on file changes, but the web page itself actually takes 30+ additional seconds before it shows the little clojure icon and becomes responsive again. Any tips?

ccann23:09:44

oh wow, it only seems to do this when the devtools console is open. I have “Disable cache” checked…

ccann23:09:41

oh wow, it was source maps!

💥 2
ccann23:09:53

I removed them from the “workspace” and now everything is snappy

raspasov08:09:42

Wow, thank you! I’ve had the same “issue” for a while and never realized that the slowdown came from source-maps and indeed it is. It was a one time cost when the REPL starts up but still good to speed it up 🙂 (I don’t believe it’s related to figwheel-main in any way though)