Fork me on GitHub
#hyperfiddle
<
2023-03-22
>
Michael W16:03:20

Is there a way to get electric to tell me which line an unserializable transfer has occurred? I keep missing places that I need to add (e/server) and since it gives me the datom from datascript rather than a line where it occurred it's a bit hard to track down where in my code the issue is.

INFO  : Unserializable reference transfer: datascript.db.Datom #datascript/Datom [8 :player/session-id "MzBVM0RORlhRK09zSDQvcmZQMDFIdz09" 536870921 true]
I'm using the same datoms all over my code so it's not exactly clear where the problem is happening.

xificurC17:03:09

This has been on our backlog for a while. For now I typically bisect-comment the code in question

šŸ‘ 2
denik19:03:59

have been building a clojure spredsheet with electric

denik19:03:05

šŸ‘ 2
denik19:03:51

cells updates trigger reactively when referenced cells update. all execution happens in parallel on separate threads

šŸ˜Æ 2
teodorlu21:03:03

wow, nice! how did you like using electric for building it? did you face any problems?

denik17:03:06

loved it! no problems. I had tried building this in reagent in the past and it quickly turned into a serialization/performance nightmare

šŸ’Æ 2
denik17:03:43

with electric those problems are non-existent

šŸ˜ 2
denik17:03:02

šŸ’Ŗ 2
teodorlu10:03:54

Nice! Spreadsheets and electric seem like a great match to me too, but I've never tried myself!

Carsten Behring20:03:20

How can I relocate an electric app to an other context root, not "/" ? Is there something in the "build" to do so ?

šŸ‘€ 2
Dustin Getz20:03:54

Electric itself doesn't know about the page's path. There are two places in userland application code that relate to the path: ā€¢ index.html or other userland page entrypoint which boots the Electric client, e.g. https://github.com/hyperfiddle/electric-starter-app/blob/main/src/user.cljs#L16-L18 - you can call this from anywhere, Electric doesn't care, it will connect by websocket protocol and doesn't interact with any ordinary http endpoints (IIUC, the team will correct me if I made any mistake) ā€¢ Application router code done from inside the Electric application. The starter app doesn't even include a router and never looks at the path (browse around the starter app src https://github.com/hyperfiddle/electric-starter-app/tree/main/src). The electric demo app does include a router https://github.com/hyperfiddle/electric/blob/7ef1612c9659d1e88f2f41223f5c7c045a5eb399/src-docs/user_main.cljc#L88-L97, so you'd need to slice off any context at this point.

Dustin Getz20:03:13

Does this answer your question?

Dustin Getz20:03:20

Note, I do not recommend you use the hyperfiddle.history router that the demo app uses, it is experimental and more complex to configure than we like. I'd recommend a simple https://github.com/hyperfiddle/electric/blob/master/src/contrib/electric_goog_history.cljc, you can modify that to deal with chopping off any parent routes

Carsten Behring21:03:02

I was wondering where this https://github.com/hyperfiddle/electric-starter-app/blob/0b4ebdfe6399db8aceaef6539f03c7ae7ac444ba/resources/public/index.html#L11 gets changed into "/js/main.57678446D54FAE742D3AB51E6C9B1E63.js" When I put the starter app into Kubernetes and and an ingress , I would need to download the js from something like "/myapp/js/,,,,,"

Carsten Behring21:03:46

Basicaly I would lkie that my electrip app is available at:

šŸ‘‰ App server available at 
instead of
šŸ‘‰ App server available at 

Dustin Getz21:03:10

Is this for at work?

Dustin Getz21:03:36

In the starter app, index.html is served by a ring middleware https://github.com/hyperfiddle/electric-starter-app/blob/0b4ebdfe6399db8aceaef6539f03c7ae7ac444ba/src/electric_server_java8_jetty9.clj#L101. The dev/ops team will need to modify the jetty server starter to suit their customizations. The starter app is NOT a production server, it is just an example, real apps need more secure auth for example

nakkaya00:03:07

If you serve index.html via /myapp route. electric will be available via /myapp and you use / for something else. You can use your own ring handlers my app lives in /app.

šŸ‘ 2
Dustin Getz11:03:32

> Q: where is <script type="text/javascript" src="$:hyperfiddle.client.module/main$"></script> rendered? see template in jetty-server https://github.com/hyperfiddle/electric-starter-app/blob/0b4ebdfe6399db8aceaef6539f03c7ae7ac444ba/src/electric_server_java8_jetty9.clj#L60-L62

Carsten Behring22:03:48

I don't get it working. There are too many places in the starter-app to change, and probably i miss some. Does somebody have an example app (with code) which is not on "/" but on "/myapp".

nakkaya02:03:19

@U7CAHM72M This is the striped down version of my core.clj electric lives under /app and a generic landing page under / [1] [1] https://gist.github.com/nakkaya/7b65ddc161aad9beb7207c8b520c47f3