Fork me on GitHub
#clojurescript
<
2019-07-20
>
tianshu06:07:42

why sometimes I can use :refer to require a macro?

tianshu06:07:24

is the :refer-macros always necessary?

Michaël Salihi12:07:04

Hi @thheller, hi guys ! When using Shadow-cljs with React-native / Expo, is it possible to reconnect the websocket / repl after manually to reload the application? Typically, Shadow-Cljs supports hot reloading so that the hot / live reload of the emulator is disabled, but sometimes, when the required namespaces are 3 sublevels components (search.cljs -> :require flat-list-movies.cljs -> :require movie-item.cljs), no changes are displayed until the root namespace (search.cljs) is modified for eg.. Thx in advance for the support ! 🙂

Michaël Salihi12:07:27

PS For the same project with Re-natal (figwheel), I can reload app without loosing Repl connection and the 3-sublevels required files hot-reload works.

thheller13:07:17

@admin055 do you have any special figwheel annotations in search.cljs? eg. (ns ^:figwheel-always your.search ..)?

thheller13:07:01

you are doing something weird if your changes only apply if the root namespace is reloaded since that shouldn't be necessary

Michaël Salihi15:07:18

@thheller I just retry with a new fresh clone of your reagent-expo repo https://github.com/thheller/reagent-expo and I can reproduce the behavior. If I recursively require namespace like : -> :require test.foo and test.foo :require test.bar modifications is hot reloaded on http://test.app and test.foo files but not on test.bar. The shadow-cljs watch app return 2 files compiled while we have 3 files. [:app] Build completed. (100 files, 2 compiled, 0 warnings, 0,05s)

Michaël Salihi16:07:00

@thheller I put here my fork with which you can reproduce the behavior : https://github.com/PrestanceDesign/reagent-expo

thheller17:07:47

I'm not sure what the problem is?

thheller17:07:52

everything looks ok to me?

thheller17:07:58

hmm I don't actually know. shadow-cljs is reloading the code as it should. I suspect that reagent is just skipping the re-render

thheller17:07:20

I can "fix" it by just calling (expo/render-root (r/as-element [root {:x (js/Date.)}])) instead of (expo/render-root (r/as-element [root]))

thheller17:07:35

I'm actually not all that familiar with reagent so I don't know why it skips rendering

thheller17:07:42

must be some internal caching I'm missing

Michaël Salihi19:07:20

Nice, thank you very much for all these informations @thheller! I think I will open an isssue on Reagent repository

Michaël Salihi19:07:17

@thheller I'm thinking about it, when using Reagent and Shadow-cljs normal project (not React-native), we don't have this behavior...the hot-reload works well in the same case. Do you know why ? Maybe it's at the :target :react-native level ? https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/cljs/devtools/client/react_native.cljs

Michaël Salihi19:07:54

Thank you for all these answers to a newbie that I am 🙂

thheller19:07:15

I'm not sure why this is happening either

Michaël Salihi13:07:57

@thheller No, for the Shadow-cljs version project, I don't have anything who concerns figwheel configuration. For information, I had clone this repo to begin my project https://github.com/PEZ/rn-rf-shadow I tried to clone one more time with simplier project which consists to 3 files/namespace and I have the same behavior with the hot-reloading. Same things, with your repo https://github.com/thheller/reagent-expo How can I debug ? Any clue ? Thx

borkdude18:07:58

in core.cljs goog.Uri is :required, but only to write (instance? goog.Uri ,,,) somewhere. maybe it should be :imported rather than required?

borkdude18:07:28

not sure what the right idiom is for that