Fork me on GitHub
Tim Brown09:02:21

@dustingetz Electric is awesome from what I've seen! Good job. I have a problem with the ReagentInterop demo: from http://localhost:8080/(user.demo-reagent-interop!ReagentInterop) I get the following 😞 I've done an npm install, along with an upgrade of node to the shiniest (v19.7.0) version... any ideas?

πŸ‘€ 1
Dustin Getz11:02:52

you have to uncomment it in i think user-main.cljc, it’s disabled to make the npm install optional

Dustin Getz11:02:07

we’re working on making the demos easier to run and find

Dustin Getz11:02:17

for now just uncomment the line locally


Pending looks cool, so I can use that to catch a situation where results are not available yet

πŸ‘ 1

what if I want to keep the previous DOM and show something in addition when Pending, I probably need a client side atom for the results?


like a content that is updating, you don’t want to replace the old content with a loading indicator


my initial thought would be maybe priority stream pulls from missionary land..? But I'm not sure how to do that yet, and there's probably a better method

Dustin Getz16:02:35

exceptions leave the try-body in place and running (so the dom stays, the catch-body is meant to add a loading on top of what is already there)

Dustin Getz16:02:58

this is because when the exception "goes away" you need to resume where you were


hmm, maybe the structure of my code is just wrong

πŸ‘€ 1
Dustin Getz11:02:06

send me a gist of what you have and a comment of what you want to happen


I’ll try, I’m not sure what I β€œwant” to happen, as I’m more trying to understand how to use

πŸ‘€ 1

this is one thing I tried, having a catch block in the UI this looks like it the β€œloading” block was always showing

πŸ‘€ 1
Dustin Getz14:02:42

Are you running master? I think we might have a regression that matches this report


I updated yesterday, I’ll try with latest

Dustin Getz14:02:16

are you blocked on this?


just doing some examples as I’m going to show some electric to other clojure programmers at work tomorrow

Dustin Getz14:02:10

";; This is showing always after initial showing," i think you are doing it right, this is a bug We refactored how exceptions work this week

Dustin Getz14:02:23

I think if you revert to the published version (v2-alpha-68) it will work properly


I’ll try reverting


even after reverting it seems that it doesn’t work properly, not it isn’t showing all the time… but the pending element only very briefly flashes in existence and is removed

πŸ‘€ 1

even when I added a 2 second thread sleep in my jdbc query function to really see it


if I put a println in the catch block, it is printed twice, once at the start and again at the end of the wait when the element flashes


ah no sorry… the element flashes twice when the waiting starts and after the wait is over

Dustin Getz14:02:52

ok, we will look into it, thanks for the report

Dustin Getz15:02:05

your latest code is on github?


I’ll push this now


I don't think this is important to the code, but what's the frequent use of :needle?

Dustin Getz16:02:54

needle in a haystack ... sorry will stop doing that ty for asking


np, just curious if it had any interesting meaning

Adrian Smith16:02:54

There's an english? Saying for something that is hard to find "It's like finding a needle in a haystack", in programming it's commonly translated to needle is the thing that you are searching for and haystack is the thing being searched


Yup. Sorry yeah it made sense as soon as I saw "needle in a haystack" πŸ™‚


Hi guys! Does electric support release code with shadow-cljs? The builds of shadow-cljs.edn config:

:builds {:app {:target :browser
                :output-dir "resources/public/js"
                :asset-path "/js"
                :modules {:main {:init-fn }}
                ;; For dev
                :dev {:devtools {:watch-dir "resources/public" ; live reload CSS
                                 :hud #{:errors :progress}
                                 :ignore-warnings true}}
                ;; For prod
                :release {:compiler-options {:optimizations :simple}}}}
But when I pack the uberjar, the server starts but the js log this error in the console. I miss something?

πŸ‘€ 1
Dustin Getz18:02:49

we do support advanced optimizations, let me get back to you


I was playing with the same idea, hit the same error. removing optimizations fixed the error. However now when I run the uberjar I get unable to resolve symbol error related to my backend functions. Am I skipping something?

Dustin Getz18:02:16

maybe we broke it, builds are getting reworked wip rn


@dustingetz Do you happen to know any repo that shows how to deploy an electric app with or without a jar? Just to cross check what I have.

Geoffrey Gaillard09:02:06

:optimization :simple has been fixed. :optimization :advanced has a regression. We will address it. > when I run the uberjar I get unable to resolve symbol error related to my backend functions > We are addressing this too. We’ll get back to you with an example of how to deploy an electric app with a jar.

πŸ‘ 3

Thanks @U2DART3HA it works and I have a valid uberjar too!

πŸ‘€ 1

@UHZPYLPU1 Any chance you can share the repo? I am still struggling with building the uberjar.


I have not repo yet @U5H4U2HEH πŸ˜… but I can describe how I manage the uberjar. This is the view of my src folder:

β”œβ”€β”€ client
β”‚   └── estimaty
β”‚       β”œβ”€β”€ app.cljs
β”‚       β”œβ”€β”€ routes.cljs
β”‚       └── util.cljs
β”œβ”€β”€ logback.xml
β”œβ”€β”€ main
β”‚   └── estimaty
β”‚       β”œβ”€β”€ core.cljc
β”‚       └── views
β”‚           β”œβ”€β”€ header.cljc
β”‚           β”œβ”€β”€ room.cljc
β”‚           β”œβ”€β”€ rooms.cljc
β”‚           └── signup.cljc
β”œβ”€β”€ server
β”‚   └── estimaty
β”‚       β”œβ”€β”€ db.clj
β”‚       β”œβ”€β”€ repository.clj
β”‚       └── server.clj
So src/client , src/server and src/main are source folder (`estimaty` is the main namespace). In my deps.edn , the dev aliase looks like this:
{:extra-paths ["dev" "src/client" "src/server" "src/main"]
 {binaryage/devtools {:mvn/version "1.0.6"}
 thheller/shadow-cljs {:mvn/version "2.20.1"}}
 ["-Xss2m" ; 
  "-XX:-OmitStackTraceInFastThrow" ;; RCF
Now this is the build.clj to build the uberjar:
(ns build
  (:require [ :as b]))

(def lib 'io/estimaty)
(def version "0.0.0-alpha0")
(def class-dir "target/classes")
(def basis (b/create-basis {:project "deps.edn"}))
(def uber-file (format "target/%s-%s-standalone.jar" (name lib) version))

(defn clean [_]
  (b/delete {:path "target"}))

(defn uber [_]
  (clean nil)
  (b/copy-dir {:src-dirs ["src/server" "src/main" "resources"]
               :target-dir class-dir})
  (b/compile-clj {:basis basis
                  :src-dirs ["src/server" "src/main"]
                  :class-dir class-dir})
  (b/uber {:class-dir class-dir
           :uber-file uber-file
           :basis basis
           :main 'estimaty.server}))
The server should know your server function. Maybe there is a better solution ^^.

πŸ‘€ 1

@UHZPYLPU1 mine is pretty much same as yours. I do get the uberjar and it loads fine, my problem occurs when I try to execute backend functions with e/server I get symbol can not be resolved error. Did you had to change anything in front end init code? In my case I split user.clj in to two, dev still launches user.clj but jar uses core.clj that has jetty start logic without shadow-clj stuff. Similarly I moved user.cljs to core.cljs and updated shadow edn accordingly.

πŸ‘€ 1

> I get symbol can not be resolved error This occur on the server, right?


Have you required your backend function to the entry point of your uberjar?


When you say backend function, I have a core/-main that jar executes which starts jetty, or do you mean something else?


In my example, my -main function is into the server.clj . In this file, I have required the backend namespaces used by all the views (like db.clj, repository.clj)


@UHZPYLPU1 lol, looks like I fixed it without realizing I fixed it. I required db ns to handle authentication in my jetty ns. Like you pointed that fixed the issue but at that point last night I already gave up on the jar so never tested again. Thank you.

😁 1