Fork me on GitHub
#shadow-cljs
<
2019-02-13
>
reset00:02:34

@thheller @lilactown this 100% solved my problem. I can’t thank you enough

👍 5
lilactown00:02:25

sure thing! 😄 the idea is that, when you change bits of your application, you need to completely re-render your application to make sure you clear out any references to the old values

reset00:02:46

This was actually something I was searching for!

reset00:02:40

The documentation is great, but there has been a lot for me to learn. I came from C++, Rust, and Erlang into Clojure back in July. I hadn’t touched the web, javascript, or Java in a really long time

lilactown00:02:59

yeah for sure. it’s all a bit overwhelming 😅

reset00:02:24

I think it’s worth the effort so far. Quite an amazing ecosystem once you wrap your head around it

reset00:02:38

I’ve never been able to iterate so quickly

lilactown00:02:43

just for completeness: if, in the future, you want to make sure something doesn’t get reloaded, you can use defonce instead of def

👍 5
lilactown00:02:01

e.g. (defonce app-state (r/atom {}))

reset00:02:08

Brilliant

lilactown00:02:36

that way your application re-renders, but your state stays the same so you don’t have to click around a bunch to get back to where you were

reset00:02:51

I literally just tagged my app-state with that now

jlmr11:02:05

Hi, I’m having trouble getting css-refresh to work in an electron app. I’m using the {:devtools {:watch-dir "<path>"}} config but it’s not working. Anyone any tips?

jlmr11:02:14

Ok it gets weirder: after refreshing the electron app, css refresh works 1 time.

jlmr12:02:55

I’ve found some more detail: 1) When I start the electron app, the css tag in index.html looks like this: <link rel="stylesheet" type="text/css" href="css/main.css"> 2) Editing the css file at that point will trigger a refresh: shadow-cljs: load CSS css/main.css. 3) The page refreshes and the css changes are reflected in the app. The dom is also modified, the css tag now looks like this: <link rel="stylesheet" type="text/css" href="css/main.css?r=0.8158209164608885"> 4) New css file edits no longer trigger refreshes. 5) After manually editing the css tag using Chrome devtools to again look like it did at step 1 refreshing again works a single time. Could this be a bug? What is the purpose of the ?r=<number? that gets added to the css tag?

thheller12:02:00

@jlmr ?r=... is used to ensure no cache is used

jlmr12:02:41

@thheller, thanks. So that part is supposed to stay 🙂. Do you have any pointers on how I could get css refresh going?

thheller12:02:17

what do the devtools have to say about this? does it just report a 404?

thheller12:02:39

guess it maybe doesn't like ? since it is loading files from the filesystem

jlmr12:02:10

Devtools doesn’t complain at all, but it’s only reloading css once after starting the Electron app

jlmr12:02:03

In the console I also don’t see a message indicating that shadow-cljs is loading the css (except for that one time)

thheller12:02:42

no "request" in the network tab?

jlmr12:02:48

nope, only on the very first reload

thheller12:02:30

I don't think I ever tested css reload in electron

thheller12:02:40

feel free to open an issue. I can look into it a bit later

jlmr07:02:51

@thheller 76bda07 fixed it! Thanks for the quick fix!

jlmr12:02:48

nope, only on the very first reload

metacritical13:02:08

Hi @thheller I was trying to bootstrap cljs on node.js in a electron app, you suggested previously to look at browser.cljs in shadow to do that, but i have encountered an issue when i load the bootstrap files it gives error while loading the analysis cache. Can you please look at the code and see what am i doing wrong ? https://github.com/42Org/b42/blob/temp/src/app/main/bootstrap/node.cljs

thheller13:02:20

uhm that looks like a completely incorrect use of core.async

thheller13:02:28

try building it without core.async

thheller13:02:22

(go (>! fchan data)) this should absolutely be avoided. just use (async/put! fchan data) if all you care about is putting a value on a chan

thheller13:02:31

or better yet async/offer!

thheller13:02:01

I can't look this properly right now. maybe later.

metacritical14:02:41

@thheller Will try what you suggested. Also it would be great if you do look at it when you have time, i would highly appreciate that. Thanks is Advance.

hyoo21:02:41

is it possible to watch “release” mode instead of “dev” mode in shadow-cljs? I want to modify and test codes in a single js like an release build because of network limitation.

thheller21:02:25

@hjfirst no that is not possible. set :devtools {:loader-mode :eval} in your build config if you want to reduce the number of files loaded (still fairly large though)

hyoo21:02:12

hmm.. I see. thanks.

hyoo21:02:03

cool. let me read and try it. thanks for info!

hyoo21:02:55

@thheller {:loader-mode :eval} helps a lot since it reduces the file numbers! 🙏

thheller22:02:15

@metacritical I implemented the full node bootstrap myself. it required tweaking the node build targets a bit anyways. should now work fine in 2.7.33.

👏 20
thheller22:02:26

@jlmr css reload in electron should also be fixed in 2.7.33