This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-06
Channels
- # aleph (1)
- # announcements (29)
- # babashka (39)
- # beginners (52)
- # cider (3)
- # cljsrn (19)
- # clojure (167)
- # clojure-europe (15)
- # clojure-nl (2)
- # clojure-uk (62)
- # clojurescript (13)
- # community-development (8)
- # cursive (5)
- # datomic (10)
- # introduce-yourself (1)
- # java (10)
- # jobs (12)
- # jobs-discuss (1)
- # kaocha (2)
- # lsp (6)
- # luminus (1)
- # malli (15)
- # meander (3)
- # music (1)
- # nrepl (2)
- # off-topic (91)
- # pathom (4)
- # reagent (21)
- # reitit (10)
- # sci (5)
- # shadow-cljs (17)
- # spacemacs (3)
- # sql (7)
- # tools-deps (40)
- # utah-clojurians (2)
- # xtdb (7)
I'm using the Krell. Whenever I add a file(*.cljs) in my project, I should re-run the commands clj -M -m krell.main -co build.edn -c
clj -M -m krell.main -co build.edn -r
respectively. Krell seems can't find the new added file without it. I'm very new to clj(s), so probably I'm missing something. Is there any way to make this flow better?
So, @anthony-galea and I managed to reproduce that ^ hot-reload freeze bug in a minimal cljsrn project. It is just a matter of def
-ing enough data structures and then hot-reload. I can make it reliably happen with shadow-cljs, but haven’t been able to make it happen with Krell. Here’s the repro project: https://github.com/PEZ/AndroidCljsrnHotreloadFreeze
It might happen only with the debugger, but I am not sure that is needed. I’ll try with even more data and see if I can provoke it w/o the debugger.
In one releaase build of our work project app, we had an exact same freeze (symptoms bug) so it might not have to do with hot-reload either.
only guess I have is that shadow will send all files over the websocket. maybe android doesn't like big messages like that?
why do you have such gigantic maps in your code? wouldn't it make more sense to keep it out of the code and load it dynamically?
It’s a bad legacy move. We really should move that map out of the project for a lot of reasons. However, our map is just one, and not this big. I don’t think the freeze is about the size of this map. Rather about the size of our project. Our big map just makes this happen earlier. Well, at least that’s what I think from having experimented with this for a while.
But you remind me that the map files do not need to be reloaded for the freeze to happen. Only core.cljs is reloaded here, for instance:
load JS awesome_project/core.cljs
call awesome-project.core/start
[React DevTools] Connection to RN closed
@woonki.moon and you required this new file in some namespace?
Yes, for example, I added foo.cljs
and I required this new file in the namespace home
which is already exists. The metro bundler keeps complaining like this. It doesn't disappear until I run the commands clj -M -m krell.main -co build.edn -c
@dnolen Some time ago I was asking about whether Krell supports specially annotated functions that are executed after a hot reload of the app (like shadow-cljs does). I wanted to use that to get proper hot reloading in my app that uses react navigation. I managed to find a solution that works for me and wanted to come back to this and let you know how I was able to do it with the help of such a function. The main idea is not my own, I found it in some blog post on the internet. After switching to shadow-cljs I added the following to my main cljs file:
(defonce component-to-update (atom nil))
(def updatable-app-root
(with-meta app-root
{:component-did-mount
(fn [] (this-as ^js this
(reset! component-to-update this)))}))
(defn reload {:dev/after-load true} []
(.forceUpdate ^js @component-to-update))
(defn init []
(dispatch-sync [:initialize-db {}])
(load-db-from-storage)
(.registerComponent AppRegistry "MyApp" #(r/reactify-component updatable-app-root)))
So I run .forceUpdate
on the root component after every reload. This will trigger a re-render of the root component which in turn will trigger some code that will recreate the navigation state from what is stored in the app-db
(whenever I navigate to some other screen I store some information about this change in the app-db
so I can always use it to recreate the state). When I now do any code changes to some inner component, they are reflected on the device immediately.What tooling do you recommend if I want to create a cljs react native mobile app ON my Android mobile? I am new to this and I want to learn by playing around. What is working so far: I have Doom emacs installed on termux, I have java, cider, clj-kondo lsp. I can compile clojure programs, and I was also able to reproduce the clojureScript examples in Carin Meiers book. "Living Clojure". I can install npm and some people reported that expo can be installed. The constraint is that I can't install the Android SDK. The idea is to produce an apk and to install it from time to time.