Fork me on GitHub
#cljsrn
<
2020-05-02
>
Oliver George12:05:22

I'm trying to port a re-natal app to Krell. I can't work out how to ensure that I see the UI update when I updated a view and the namespace reloads. Using the approach from the Krell Reagent tutorial I'm not getting a UI refresh unless I modify the awesome-project.core ns.

Oliver George12:05:57

I've tried a few variants on porting the re-natal onreload approach of counter r/atom plus clearing re-frame's subscription cache. No joy. Also tried calling force-reload! manually since the -main isn't a great location for the call.

(def cnt (r/atom 0))
(defn reloader [] @cnt [navigation-screen/container])

(defn force-reload! []
  (re-frame/clear-subscription-cache!)
  (swap! cnt inc))

(defn ^:export -main [& args]
  (re-frame/dispatch-sync [:app/bootstrap])
  ;(force-reload!)
  (r/as-element [reloader]))

Oliver George12:05:37

But if I modify that file the krell reload process does give the result i'm looking for. Just not sure how.

Oliver George12:05:06

Related... currently the Krell REPL doesn't signal to the app whether -main is being called to start the app or as part of a reload. That distinction would be handy to avoid "bootstrapping" happening multiple times. It's fixable with additional app state but by rights is dev only concern.

Oliver George13:05:37

Okay, a simple repro isn't immediately backing me up. It might be something more complicated than I thought. I’ll try again tomorrow

👍 1