rum: defc error with shadow-cljs. Makes Rum unusable for me... :(

   5 | (rum/defc hello-world [g]
   6 |   [:div
   7 |    [:h2 g]
---------------^----------------------------------------------------------------
Use of undeclared Var shadow-rum.core/g

This happens when shadow-cljs reloads my file (remounts the hello-world component) It is not happening with repacing this rum dependency with [ua.modnakasta/rum "0.11.0-2"]

Steps to reproduce:

  • run lein new shadow-cljs projectname +rum && cd projectname && yarn install && yarn shadow-cljs watch app
  • visit localhost:8700 and see it working
  • edit src/projectname/core.cljs so that hello-world component gets an additional argument and displays it. (I removed the display of the atom state)
  • call the hello-world component with some string and save the file
  • see it correctly updating in the browser
  • stop the shadow-cljs watch process
  • change the dependency in shadow-cljs,edn from [ua.modnakasta/rum "0.11.0-2"] to [rum "0.12.4"]
  • again run yarn shadow-cljs watch app, visit in the browser (maybe you already see the error
  • if not, modify src/projectname/core.cljs and save the file

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 22 (3 by maintainers)

Most upvoted comments

I don’t have an answer for this issue right now.

I have, though, maybe 😃 https://github.com/tonsky/rum/pull/234

a prev one

That would be the future proof way yes. Although the requiring-resolve trick won’t work given that its a macro. Not sure why this is done in the first place though.