Fork me on GitHub
#shadow-cljs
<
2019-07-08
>
isak13:07:38

@ahmed1hsn do you see the heads-up display that the code has loaded?

aisamu13:07:54

This might mean that the code was loaded correctly, but it's not being picked up by the running application. Are you able to trigger a simple println via the :after-load configuration?

aisamu13:07:51

I assume keechma is able to do hot code reloading properly, given the example: https://keechma.com/annotated/graph-data/ (right at the bottom) There are a lot of gotchas with that in general, so it's useful to ensure all the steps are executing correctly.

Ahmed Hassan17:07:45

This is console log of shadow-cljs after saving changes to outcry_mobile/ui/main.cljs. Problem is that changes visible in running application. Behavior and look of UI remains same after this.

Ahmed Hassan17:07:00

Yes I'm already doing steps mentioned in above link.

thheller17:07:21

and what do you do in the start fn?

thheller17:07:45

shadow-cljs has done its job. everything else is up to you.

๐Ÿ‘ 4
Ahmed Hassan17:07:03

(defn ^:dev/start start [] (print "startt") (reload))

thheller17:07:29

^:dev/start that does nothing

thheller17:07:38

what does the (reload) do?

Ahmed Hassan17:07:21

(defn reload [] (let [current @running-app] (if current (app-state/stop! current start-app!) (start-app!))))

thheller17:07:00

so that probably on calls stop! right?

thheller17:07:23

assuming current exist it'll call stop!

thheller17:07:38

unless you call start-app! in stop! that probably is your problem?

Ahmed Hassan17:07:44

start-app! is callback, which is called after stop!.

thheller17:07:39

but why do you have a stop callback and then actually only stop on reload?

Ahmed Hassan17:07:41

current is app-definition/app-config here.

Ahmed Hassan17:07:34

look at https://keechma.com/annotated/graph-data/ last lines of code at right here.

Ahmed Hassan17:07:36

stop callback is optional param.

Ahmed Hassan17:07:26

You can just have (app-state/stop! current) called and app would be stopped. But you would have to start it again yourself.

thheller17:07:43

thats what shadow-cljs does though

thheller17:07:53

you have a stop callback which is called BEFORE your code is reloaded

thheller17:07:56

then your code is loaded

thheller17:07:00

and start is called

thheller17:07:30

all you really need to do is re-render your app

Ahmed Hassan17:07:51

So, we need to stop! in ^:dev/before-load and start-app! in ^:dev/after-load. right?

thheller17:07:09

those annotations do not exist. don't know where you got them from

โœ”๏ธ 4
thheller17:07:22

it is :dev/before-load and :dev/after-load

โœ”๏ธ 4
thheller17:07:12

but you seem to have them configured in the build config already since they are getting called

โœ”๏ธ 4
thheller17:07:19

don't need to do both

โœ”๏ธ 4
Ahmed Hassan13:07:22

I'm using keechma.

isak13:07:52

yea, though I assume it has some kind of call to render the UI, right?

isak13:07:44

something like this needs to get called after the code is reloaded: https://github.com/mhuebert/shadow-re-frame/blob/master/shadow-cljs.edn#L31

Ahmed Hassan13:07:47

yeah, though I have reload hooks setup according to stop and start app.

isak13:07:47

hm ok, I guess I don't know enough about keechma to be able to help

thheller14:07:31

@ahmed1hsn the browser console should tell you what shadow-cljs is doing

hlolli16:07:35

is this what the chat up here is refering to?

shadow-cljs - config: /home/hlolli/Documents/visitor/shadow-cljs.edn  cli version: 2.8.40  node: v10.15.2
shadow-cljs - starting via "clojure"
Exception in thread "main" java.io.FileNotFoundException: Could not locate shadow/cljs/devtools/cli__init.class, shadow/cljs/devtools/cli.clj or shadow/cljs/devtools/cli.cljc on classpath.

thheller16:07:39

yes. as of 2.8.40 you must add the shadow-cljs dependency to deps.edn manually

hlolli16:07:50

I see, I noticed that my cli version was 2.8.40 and my project was 2.8.36. I'll add it, thanks!

carkh16:07:06

hum what could cause shadow-cljs to just close after a little while ... after encountering the problem, i have updated to 2.8.40 on both npm and in my project and it still just closes after about a minute or so

carkh16:07:26

the project was working fine a couple weeks ago

thheller16:07:41

how are you using it?

thheller16:07:57

it should never be doing this on its own

carkh16:07:12

i tried as a base line ...npx shadow-cljs server .... with deps.edn

carkh16:07:44

is there some kind of log i could find ?

thheller16:07:18

no really no

thheller16:07:29

so you run npx shadow-cljs server and then do what?

thheller16:07:41

nothing and it will exit after a minute or so?

carkh16:07:59

i do nothing

carkh16:07:21

last cli line is "shutting down ..."

thheller16:07:28

and it actually starts normally? not like throws exception all over the place on startup?

carkh16:07:33

so it's gracefull at least =)

carkh16:07:03

some npm warnings about missing package.json, but that was always there

thheller16:07:10

that shutdown should only happen if you CTRL+C or CTRL+D the npx process

carkh16:07:56

npm WARN cark.tags No description

carkh16:07:18

i don't have a package.json, but that never was a problem

thheller16:07:49

you should always have one. how are you getting your npm packages otherwise?

carkh16:07:16

i have the package-lock.json

thheller16:07:31

how do you get that if you don't have a package.json?

carkh16:07:54

it just appears when i install npm packages

carkh16:07:27

i'll take the time to make one and see if that fixes anything, though i have my doubts

thheller16:07:14

it probably won't but you should still have one regardless. seems weird to not have one.

thheller16:07:32

but yeah shadow-cljs itself definitely won't exit unless some exit condition is reached

thheller16:07:46

ie. the npx process is killed or closed

carkh16:07:05

i watched memory usage, looked like not so bad

thheller16:07:09

maybe something else is killing node processes? or java processes?

carkh16:07:12

hum i've been using kaocha for days at a time recently and i think it has both java and node cljs running

thheller16:07:18

and you are doing absolutely nothing to the process? not even starting a watch or whatever?

carkh16:07:49

let me close absolutely everything and report back

carkh16:07:30

yep same thing, looks to be about 1 min after it's "ready", i'll try an empty project

thheller16:07:02

can you paste the entire log?

thheller16:07:27

running: cmd /C npm install --save react-grid-layout@^0.16.6 highlight.js@^9.12.0 reakit@^0.11.1 react-icons@^2.2.7

thheller16:07:37

thats one reason to have a package.json so it doesn't do that all the time

carkh16:07:42

yes that thing is different i think

carkh16:07:12

so i started a new app npx create-cljs-project acme-app

carkh16:07:21

and same thing, only faster

thheller16:07:35

C:\Users\thheller\code\tmp\acme-app> npx shadow-cljs server
shadow-cljs - config: C:\Users\thheller\code\tmp\acme-app\shadow-cljs.edn  cli version: 2.8.40  node: v11.9.0
shadow-cljs - updating dependencies
Retrieving thheller/shadow-cljs/2.8.40/shadow-cljs-2.8.40.pom from 
Retrieving thheller/shadow-cljs/2.8.40/shadow-cljs-2.8.40-aot.jar from 
shadow-cljs - dependencies updated
[2019-07-08 18:51:16.283 - WARNING] TCP Port 9630 in use.
shadow-cljs - server version: 2.8.40 running at 
shadow-cljs - nREPL server started on port 51194

thheller16:07:41

wth ๐Ÿ˜›

carkh16:07:16

nice indenting you got there =)

thheller16:07:04

its not exiting at all

carkh16:07:26

yes must be something on my end obviously or you would have an uproar in thic chan =)

carkh16:07:00

i just have no idea on how to debug it

carkh16:07:29

hum looks like i'm on ancient 1.8 java version

thheller16:07:53

1.8 is fine

carkh16:07:36

npw 9.7.1, npm 6.10.0

thheller16:07:44

maybe you have some over eager anti-virus stuff or so going crazy?

carkh16:07:57

ah that could be it

thheller16:07:25

no clue why it would be killing node processes but these programs tend to do lots of nonsense ๐Ÿ˜›

carkh16:07:36

that's the one thing that changed, i'll test and tell you in a little while

thheller16:07:20

do you get a windows firewall dialog? asking if you are allowed to use port 9630?

thheller16:07:40

those something disappear into the background

carkh16:07:02

no firewall, but malawre byte updated and is again "pro" for a little while, this has some port watching stuff i think

carkh16:07:30

that was it, thank you so much

carkh16:07:42

it works, at least for now =)

David Pham17:07:58

Hello everyone :) I am using the reagent-expo repository, with an updated expo SDK to 33 and set the target to web. I blocked request from /sockjs-node/* to allow hot reloading from shadow-cljs, but every time I compile the cljs code, expo also compile the web, but the website does not update. Anyone has some experience on how to solve this?

thheller17:07:32

disable expo reloading in the app itself?

thheller17:07:39

no need to block requests?

David Pham17:07:51

It is web, so I canโ€™t find the expo option for it

David Pham17:07:02

It works perfectly on mobile

thheller17:07:14

what does that mean? "It is web"?

David Pham17:07:52

In the targets of the app.json, you can add โ€œwebโ€ so that expo uses react native web

thheller17:07:24

so its not actually react-native but a pure browser?

thheller17:07:38

not a clue about that. never tested that

thheller17:07:37

there probably is an option to disable the live-reload. just blocking the requests is not enough since it likely still has some sort of other connection open

David Pham17:07:53

Ok i will try to dig in! Thanks a lot for your help and for the tool!

David Pham17:07:07

You really made my path to cljs much easier!

Ahmed Hassan17:07:45
replied to a thread:@isak yes I do.

This is console log of shadow-cljs after saving changes to outcry_mobile/ui/main.cljs. Problem is that changes visible in running application. Behavior and look of UI remains same after this.

neupsh17:07:33

@neo2551 It does hot load the code for me. I have https://github.com/neupsh/rn-rf-shadow which is fork from PEZ's repo based off of thheller's repo

David Pham17:07:18

I tried to understand what is the difference between theller version and the repo though lol

David Pham17:07:24

Thanks for answering on github :)

David Pham18:07:22

Ok it works on your repo! @neupsh

๐Ÿ‘ 4
David Pham19:07:44

Ok i got it, in reagent-expo the main in package.json in the file in node_module, whereas in the other repos, the main is ./app/index.js