Fork me on GitHub
#reagent
<
2022-12-09
>
Sam Ritchie17:12:59

hey all - is there some way to get my reagent project to NOT use the minified production version of react?

Sam Ritchie17:12:06

I am seeing some errors that I am having a lot of trouble debugging

Sam Ritchie17:12:15

coming from react…

Sam Ritchie17:12:44

but this only happens on the first page load after I rebuild the javascript, EVEN THOUGH the browser is not caching main.js ??

Sam Ritchie17:12:40

with source maps:

lilactown17:12:58

depending on what build tool you're using, you can provide different files for your JS dependencies

lilactown17:12:06

is this after a release build?

Sam Ritchie17:12:01

but only on the first load, once I serve the file with http-server. it doesn’t seem to happen on first load at , where I’ve deployed the file, either

Sam Ritchie17:12:10

so it’s a transient local thing? but I don’t get how that could be happening with no caching of the file

lilactown17:12:45

I do see G is not a function in my console when I visit that URL

Sam Ritchie17:12:59

if you reload does it persist?

lilactown17:12:07

I also see an error Cannot read properties of null (reading 'create') above it

Sam Ritchie17:12:21

yeah, I fixed that, that was a separate issue

lilactown17:12:24

I don't see it after I reload the page

Sam Ritchie17:12:25

just haven’t deployed yet

Sam Ritchie17:12:30

I also don’t see it on safari, just on brave

Sam Ritchie17:12:19

interesting… so if I DON’T regenerate the file, but simply restart the http-server, then I get that failure again

Sam Ritchie17:12:40

oh, I think I’ve pinned down what’s going on

lilactown17:12:46

I can pretty reliably trigger the error if i open the page without devtools opened in Chrome

lilactown17:12:12

Close devtools -> reload -> open devtools -> observe error

Sam Ritchie17:12:53

it is happening when I try and interact with this defonce form:

Sam Ritchie17:12:18

all of this code is actually running inside of an sci environment, so something suspicious is happening here

Sam Ritchie17:12:45

okay, I fixed it by renaming that atom. this feels like something with sci

Sam Ritchie17:12:50

thanks for staring with me!

Sam Ritchie18:12:17

@lilactown I figured it out… I was using a useEffect hook and had a code path that returned nil from my mount function, instead of an unmount function.

🎉 1
lilactown20:12:38

#CRRJBCX7S solves this out of the box for you 😉

❤️ 1
Sam Ritchie18:12:39

looks like in react 18, with advanced compilation, that triggered a bug