fulcro

tony.kay 2024-12-29T03:57:32.731619Z

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

tony.kay 2024-12-30T16:42:51.823669Z

could you try his patches on your project?

Yaw Odame 2024-12-30T20:27:52.028289Z

I have some time do do it now. Are you able to pair on this?

tony.kay 2024-12-30T20:57:19.984209Z

hey, yeah, I could spend a few minutes

Yaw Odame 2024-12-30T20:57:27.965559Z

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.

Yaw Odame 2024-12-30T20:57:40.277199Z

Will ping you on tupel

Yaw Odame 2024-12-31T17:20:38.989459Z

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.

tony.kay 2024-12-31T18:14:06.938999Z

thanks.

tony.kay 2024-12-31T18:19:24.724959Z

release of inspect and devtool remote done. See if that all works now?

Yaw Odame 2024-12-31T18:56:40.117149Z

It works!

🎉 1
Yaw Odame 2024-12-29T15:34:27.180599Z

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 ()

tony.kay 2024-12-29T21:07:46.394469Z

did you ttry looking at the code of taoensso$encore$uuid

tony.kay 2024-12-29T21:09:01.426209Z

guessing it is this:

(if-let [f (oget js-?crypto "randomUUID")]

tony.kay 2024-12-29T21:09:39.863729Z

sounds like another case where a js assumption is made in those libs that isn’t true 😕

tony.kay 2024-12-29T21:11:42.201909Z

These are definite bummers. I didn’t realize taoensso’s libs had become so non-functional in node and RN envs

tony.kay 2024-12-29T21:12:31.040949Z

I’d suggest patching it and sending PRs to him

tony.kay 2024-12-29T21:13:34.018229Z

(if-let [f (oget js-?crypto "randomUUID")]
should probably be something more like:
(if-let [f (or (and js-?crypto (oget js-...)) random-uuid)]

tony.kay 2024-12-29T21:14:11.305949Z

or

(if-let [f (or (catching (oget ...)) random-uuid)]

tony.kay 2024-12-29T21:14:39.491589Z

or perhaps he’ll suggest that you make sure js-crypto is available? Don’t know

tony.kay 2024-12-29T21:15:09.913059Z

Thanks for pointing out the problems. I had not tried RN yet

tony.kay 2024-12-29T21:19:58.756359Z

Did you report the other issue with Sente? I think it would be good to send PRs for both, actually

tony.kay 2024-12-29T21:20:22.912479Z

I guess I could let him know via issues, since I’ve hit the first one as well

Yaw Odame 2024-12-29T21:23:19.460869Z

You bet. I’d like to try out statecharts on my RN app. No, I haven’t reported the issue to sente yet.

tony.kay 2024-12-29T21:26:55.351479Z

https://github.com/taoensso/encore/pull/81

tony.kay 2024-12-29T21:30:15.076249Z

On sente, try upgrading to the latest…he has a patch for the addEventListener there. I’m curious if that fixes it.

tony.kay 2024-12-29T21:30:58.082119Z

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.

tony.kay 2024-12-29T21:31:33.434329Z

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.

tony.kay 2024-12-29T21:34:45.236259Z

Actually, I found a way to submit an issue that might be palatable: https://github.com/taoensso/sente/issues/458

Yaw Odame 2024-12-29T21:35:18.123409Z

I have a few minutes. I can try the latest sente version.

Yaw Odame 2024-12-29T21:35:22.786559Z

one sec please.

Yaw Odame 2024-12-29T21:46:38.179519Z

Responded to your issue on sente. The latest version did not work 😞.

tony.kay 2024-12-29T03:57:46.148279Z

I should probably submit a bug report, or a patch

tony.kay 2024-12-29T03:58:07.986719Z

That bit of code in sente should be wrapped in a check to see if the function is defined