Ah, this is a problem in sente. It assumes in JavaScript that you have a top level window, which in turn has the function addEventListener. I made a little polyfill that I thought was automatically loaded in JavaScript in order to patch that global function to a no-op, because it really isn't needed in node or react native. If you put in some sort of code that tries to make that function a noop it should fix it
could you try his patches on your project?
I have some time do do it now. Are you able to pair on this?
hey, yeah, I could spend a few minutes
I set up an alias in my project to a local version of fulcro-devtools-remote using sente version 1.20.0-RC1. The issue is still present. Enabling my no-op function resolves it, however. Compiled taoensso.sente.js file:
goog.global.addEventListener("beforeunload",(function (event){...
The JS does not appear to have the try/catch.Will ping you on tupel
There's a cut of a new version of sente with the RN fix. I pushed up a quick fulcro-devtools-remote PR with an updated deps.edn.
thanks.
release of inspect and devtool remote done. See if that all works now?
It works!
The no-op suggestion helped, but reached another error, ha. Seems taoensso.encore / Fulcro Inspect trying to access properties on an unexpected value.
(NOBRIDGE) INFO 2024-12-29T15:14:45.807Z INFO [app.property-pro.client-native:44] - Starting App
(NOBRIDGE) INFO 2024-12-29T15:14:45.815Z INFO [com.fulcrologic.devtools.common.target:?] - Devtool attempting to connect
(NOBRIDGE) ERROR Warning: 2024-12-29T15:14:45.822Z ERROR [com.fulcrologic.devtools.electron.target:?] -
TypeError: right operand of 'in' is not an object
at get ()
at anonymous ()
at taoensso$encore$uuid ()
at anonymous ()
at anonymous ()
at anonymous ()
at anonymous ()
at com$fulcrologic$devtools$electron$target$start_ws_messaging_BANG__$_guardrails_wrapper ()
at com$fulcrologic$devtools$electron$target$start_ws_messaging_BANG_ ()
at anonymous ()
at com$fulcrologic$devtools$common$protocols$_connect_BANG_ ()
at com$fulcrologic$devtools$common$protocols$connect_BANG__$_guardrails_wrapper ()
at com$fulcrologic$devtools$common$protocols$connect_BANG_ ()
at com$fulcrologic$devtools$common$target$connect_BANG__$_guardrails_wrapper ()
at com$fulcrologic$devtools$common$target$connect_BANG_ ()
at fulcro$inspect$tool$add_fulcro_inspect_BANG_ ()
at app$property_pro$client_native$init ()
at global (JavaScript:4:42)
at eval (native)
at anonymous ()
at anonymous ()
at anonymous ()
at loadModuleImplementation ()
at guardedLoadModule ()
at metroRequire ()
at global ()
did you ttry looking at the code of taoensso$encore$uuid
guessing it is this:
(if-let [f (oget js-?crypto "randomUUID")]
sounds like another case where a js assumption is made in those libs that isn’t true 😕
These are definite bummers. I didn’t realize taoensso’s libs had become so non-functional in node and RN envs
I’d suggest patching it and sending PRs to him
(if-let [f (oget js-?crypto "randomUUID")]
should probably be something more like:
(if-let [f (or (and js-?crypto (oget js-...)) random-uuid)]or
(if-let [f (or (catching (oget ...)) random-uuid)]
or perhaps he’ll suggest that you make sure js-crypto is available? Don’t know
Thanks for pointing out the problems. I had not tried RN yet
Did you report the other issue with Sente? I think it would be good to send PRs for both, actually
I guess I could let him know via issues, since I’ve hit the first one as well
You bet. I’d like to try out statecharts on my RN app. No, I haven’t reported the issue to sente yet.
On sente, try upgrading to the latest…he has a patch for the addEventListener there. I’m curious if that fixes it.
The latest version has this:
#?(:cljs
(when-not node-target?
(.addEventListener goog/global "beforeunload"
(fn [event] (reset! client-unloading?_ true) nil))))
which seems like a fix that will not work for RN, but I’d still like to know, and I won’t put in an issue unless I have verified it’s actually a problem.So, I’m not going to submit an issue for that one, though if you can verify it doesn’t help, then I’d encourage you to submit an Issue report on those lines of code in a RN context.
Actually, I found a way to submit an issue that might be palatable: https://github.com/taoensso/sente/issues/458
I have a few minutes. I can try the latest sente version.
one sec please.
Responded to your issue on sente. The latest version did not work 😞.
I should probably submit a bug report, or a patch
That bit of code in sente should be wrapped in a check to see if the function is defined