This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-31
Channels
- # aleph (37)
- # babashka (23)
- # beginners (46)
- # calva (1)
- # catalyst (12)
- # cider (3)
- # circleci (5)
- # clj-kondo (8)
- # clojure (188)
- # clojure-europe (28)
- # clojure-nl (1)
- # clojure-norway (84)
- # clojure-sweden (2)
- # clojure-uk (1)
- # clojurescript (6)
- # clr (1)
- # cursive (4)
- # datahike (4)
- # datascript (7)
- # datomic (31)
- # deps-new (16)
- # emacs (4)
- # fulcro (4)
- # gratitude (17)
- # hyperfiddle (24)
- # introduce-yourself (4)
- # jobs (5)
- # off-topic (84)
- # pathom (10)
- # polylith (21)
- # portal (6)
- # re-frame (6)
- # reitit (4)
- # releases (1)
- # sci (74)
- # specter (3)
- # tools-build (3)
- # tools-deps (5)
Hello everyone, I'm looking for an idiomatic way to add that delay to button. For example, after the user clicks the button it will be disabled for 1 second to prevent multi-clicking etc. How can I show my query's result or alert message on the page with a popup or HTML alert? (I tried js/alert but was not able to progress on it, a popup doesn't appear)
The ui4 namespace contains a button implementation that disables itself and adds a spinner while the e/fn callback is pending (waiting for server to process your request). This is more resilient and correct than adding arbitrary delays
@U04SVJW7DLZ please paste the code you tried
Sorry about my late answer, @U09K620SG I need to re-write that code to send here. (ui/button (e/fn [] (js/alert "hello ") ) (dom/text "alert!") (dom/props {:class "alert" :name "alert-button" :style {:text-align "center"} })) Nothing happened after I clicked the button, I am not sure that I am using it in the correct way but in past Slack massages, I saw some similar usages.
Looks fine to me, a working button example can be copy pasted from here: https://electric.hyperfiddle.net/user.demo-toggle!Toggle
try println instead of js/alert
println working nicely, I can see printed text on the console. How can I use HTML alerts or JS alerts in Electric. Thanks for separating time 🙂
are you on latest electric? what version are you using
please upgrade that is very old
at java.base/java.lang.Thread.run(Thread.java:833) DEBUG hyperfiddle.electric-jetty-adapter: Client disconnected for an unexpected reason. {:status 1011, :reason Cannot invoke "clojure.lang.IFn.invoke(Object)" because the return value of "clojure.lang.RT.aget(Object[], int)" is null}
unfortunately you must upgrade
the changelog documents breaking changes (may not impact you) and you'll need to validate your configuration against the starter app https://github.com/hyperfiddle/electric-starter-app
You'll need to debug it unfortunately
Perhaps easier to start with a fresh clone of the starter app and copy your code in
first thing to check is see if your entrypoint is different from the starter app
@U09K620SG hello, https://github.com/hyperfiddle/electric-starter-app/blob/main/deps.edn is that version the latest one? I am going to clone it if yes.
yes this the latest starter and is the correct thing to clone
bump electric dep to v2-alpha-428 though