cursive

Issues at: https://git.io/cursive-issues
Harish Tella 2020-09-08T17:10:11.046500Z

Hello all, does anyone here use Figwheel with IntelliJ (Cursive)? This question is likely more IntelliJ-related than Cursive-related, but I thought this would be a good audience to ask. When I save a file in IntelliJ, my running Figwheel instance does not do a hot-reload right away. I have to switch my focus to the browser or the Figwheel repl for the hot reload to happen. When saving a file in a different editor, VS Code for example, the hot-reload happens right after saving. I think this has something to do with the virtual filesystem setup by IntelliJ. Something about saving a file in IntelliJ doesn’t alert other programs like normal. An other clue is when I execute the Reload All From Disk command inside IntelliJ, the hot-reload happens. If anyone has a clue it would be a huge step towards front-end nirvana.

Harish Tella 2020-09-09T14:07:08.056900Z

Oh you are brilliant. That one question solved it for me. ⌘-S was not bound to anything in IntelliJ. I just assumed it was. It must have auto-saved when I switched the focus off of IntelliJ. After binding ⌘-S to Save All , everything works like it should. Thank you so much. And thank you for Cursive. I really love it.

cfleming 2020-09-09T19:52:00.057200Z

Great! I’m glad it’s working. And thanks for the kind words, I’m glad you’re liking Cursive!

2020-09-08T17:15:48.047500Z

I have this in my core.cljs file:

(defn ^:after-load refresh-on-figwheel-reload
  []
  (rf/dispatch [:globals/refresh-on-figwheel-reload]))
Do you have something like that?

Harish Tella 2020-09-08T17:19:18.050300Z

Hey, yup mine is like this

(defn ^:after-load re-render []
  (rdom/render [views/app] (dom/$ "app")))

Harish Tella 2020-09-08T17:19:47.051Z

Just re-rendering a reagent component to the dom.

2020-09-08T17:19:55.051300Z

My CLJS files do refresh, but it can take a bit of time to re-compile, plus even after the refresh happens, my UI doesn’t necessarily re-render until it notices a data change. I have the refresh-on-figwheel-reload event handler set up to increment a value in the app-db, and then in my main page render I have

(fn []
      ^{:key (str "figwheel-refresh-key-" @[:globals/figwheel-refresh-key])}
        [:div.container 
          ;; main page container
        ])

2020-09-08T17:20:32.051400Z

Hmm, seems like it should work then

Harish Tella 2020-09-08T17:21:30.051600Z

Yeah, I think this part is good. But thank you all the same. Your CLJS files refresh without taking focus off of IntelliJ?

2020-09-08T17:21:44.051800Z

You might try the ^{:key ...} trick, sometimes React does some internal caching that causes it to hold on to old renderings.

Harish Tella 2020-09-08T17:23:03.052Z

Ok, I’ll give that a try.

2020-09-08T17:23:08.052200Z

Generally I can’t see my browser while IntelliJ has the focus, because the browser and the IDE are both full-screen on the same monitor, but I’ve seen CLJS debug messages scroll by in the CLJS REPL, so I’m assuming so.