Fork me on GitHub
#cljfx
<
2021-09-25
>
Luis Santos18:09:24

Hi everyone, Is there a way to refresh the scene every time one of my "components" gets re-evaluated? I was looking for a way to do this with nrepl and cider. More details here: https://clojurians.slack.com/archives/C17JYSA3H/p1632594201013200 Thanks

vlaaad19:09:45

You have your state atom somewhere, call (swap! the-atom identity)

vlaaad19:09:22

You can probably setup your editor to send this form on some keystroke

Luis Santos20:09:34

Hi @U47G49KHQ , Thank you very much for you support. Refreshing the scene when the state changes is working as expected. My challenge is to refreshing the scene when the one of the component (functions) gets updated via repl.

Luis Santos20:09:39

Currently I have to run the renderer function every time one of the components changes.

(def renderer
  (fx/create-renderer
   :middleware (fx/wrap-map-desc (fn [state]
                                   {:fx/type root-view
                                    :state state}))
   :opts {:fx.opt/map-event-handler event-handler}))

thom07:09:44

You could have a save hook in your editor that issues the right command, that’s what I mostly do. That said, I often find just resizing the window is convenient enough to trigger a redraw.