cljfx

Luis Santos 2021-09-25T18:26:24.008300Z

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

thom 2021-09-27T07:16:44.011100Z

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.

vlaaad 2021-09-25T19:15:45.008400Z

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

vlaaad 2021-09-25T19:16:22.008600Z

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

Luis Santos 2021-09-25T20:10:34.008900Z

Hi @vlaaad , 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 Santos 2021-09-25T20:11:39.009100Z

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}))