Fork me on GitHub
#cljs-dev
<
2018-08-13
>
bhauman00:08:57

@mfikes I'm running into the https://dev.clojure.org/jira/browse/CLJS-2854 bug on reloads with figwheel.main

mfikes00:08:07

As in when you do (require 'my-lib :reload) ?

bhauman00:08:58

no when I reload the page

bhauman00:08:04

by hitting refresh

mfikes00:08:49

Ahh. I’ve done practically zero web dev with ClojureScript, so I don’t even know what happens in that case.

bhauman00:08:17

this only happens when when I change the dependency tree during developement

mfikes00:08:49

Curious if CLJS-2854-2.patch solves it

bhauman00:08:04

but strangely enough it persists when I reload the page

bhauman00:08:33

I'd have to track it down further

bhauman00:08:00

the strange thing is its in the deps file, but the async loading is still happening I guess

bhauman00:08:49

I think there would still be top level races

bhauman00:08:57

even with the patch because like if you call react-dom render at the top level it will happen before the var is defined

mfikes00:08:59

Yeah. The only raceless approach I can think of is the idea of having the compiler couch the the global-exports initialization code (that one line) as a lib that itself depends on the foreign lib, and adjust any code that requires that foreign lib to instead require the global-exports initialization pseudo-lib.

bhauman00:08:54

yeah that would work

bhauman00:08:25

I'm still curious why I'm having troubles on page refresh

bhauman00:08:53

because figwheel is preloaded and async takes over before the main ns is required

bhauman00:08:29

its strange that the first load works fine

bhauman00:08:48

but its only when you change (add/remove js module) deps that you get into this state

bhauman00:08:51

also i get the

Error: Cannot find module '@cljs-oss/module-deps'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)

bhauman00:08:55

when I add or remove module deps and recompile

bhauman00:08:56

I fixed the race by prepending the :main ns to :preloads

bhauman00:08:24

and that has fixed it for both the reload and refresh cases, so I'm confused

bhauman00:08:17

OK I'm tracking it down to some strange dependency detection error in figwheel-main

bhauman12:08:42

@mfikes I fixed this problem, and it wasn't a problem in ClojureScript proper, I was missusing the api.

bhauman12:08:20

in fact the solution I came to may fix your problem