This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-11
Channels
- # ai (2)
- # announcements (5)
- # babashka (16)
- # beginners (24)
- # calva (22)
- # clerk (2)
- # clj-yaml (4)
- # cljsrn (1)
- # clojure (15)
- # clojure-dev (7)
- # data-science (5)
- # datalevin (1)
- # emacs (21)
- # events (1)
- # hyperfiddle (33)
- # lsp (71)
- # membrane (1)
- # podcasts-discuss (1)
- # practicalli (11)
- # re-frame (17)
- # reagent (3)
- # sci (1)
- # shadow-cljs (47)
- # transit (1)
now I can't unsee how inelegant react is. manipulating dom nodes is a side effect so why does useEffect
even exist? so electric is like if every form was wrapped in useEffect
with its dependencies auto-inferred
you mean integrating Electric with an external clojure DI framework? or are you looking for an Electric-native idiom for DI?
I already made a decent feeling macro-based solution for clojure-only DI (e.g. injecting a database connection) but am curious if you guys have thought about it too
why do you want to integrate an external DI framework? maybe what you want can be accomplished with electric itself
electricโs reactive dynamic bindings are basically equal in power to a DI framework
there are non-electric components that use this database connection, say a kafka streams app
ah ok
would love to take a look at your repo so we can understand the use case
it's too much work for something I already have a reasonable solution for sorry, but I think it wouldn't be uncommon for someone to want to add electric to their existing luminus/ duct based web app
we will provide templates for that once we have understood the use case
I think for dependency injection this has to work
(defn foo! [x]
(e/defn Foo [y]
(str x y)))
but e/defn
does all its work at compile time, so this can never close over anything at runtime?i need to understand the use case, iโm sure we can come up with a good pattern
In clojure, what is the best REBL-like tool for connecting to an API and browsing it as data? Like, say, the github API, and hopefully using a high level object model, for example PyGithub via libpython-clj. Or casually traversing JSON might be enough
I use portal but never had to interact with it's api. Reveal is another to look at as well.
@U7RJTCH6J is doing some interesting experiments in this area too. There is a https://youtu.be/yPurwuTOHCE where he demos to @U6VPZS1EK.
The tool I demo works best if you already have the data locally. I use it frequently, but it's currently alpha. You might also interested in https://github.com/wilkerlucio/pathom-viz/. https://www.youtube.com/watch?v=YaHiff2vZ_o
I think #clerk would also work well as a means for exploring an API like github's.
For exploring github, you could probably do something cool with https://unpkg.com/browse/@octokit/[email protected]/generated/api.github.com.json
thank you @U7RJTCH6J i need some time to digest
I'm having an issue with an svg, one of the properties for an svg animation is called xlink:href, but I cannot seem to make it work using svg/animate
Here is a sample:
(svg/animate (dom/props {:attributeName "font-size"
:from "50"
:to "75"
:dur "1s"
:repeatcount "1"
:begin "click"
:xlink:href (str "#" tilename)}))
This obviously gives me an error in clojure, seeing as that is not a proper keyword. I looked at the macro that creates the animation document element but am not understanding how to translate that property name to a proper clojure keyword.try a string
Failed to execute 'setAttributeNS' on 'Element': '' is an invalid namespace for attributes.
in ( hyperfiddle.electric-dom2/set-property! #object[SVGAnimateElement [object SVGAnimateElement]] xlink:href #tile0 )
I tried "xlink:href"
and got that error, when I try :xlink/href
that gets translated to just href on the properties, not "xlink:href" which would be the correct property.
Ok, I will take a look with the team next week, are you blocked?
No it's just animations, I've got plenty of other stuff that is higher priority, I was just messing with animations for fun. Eventually I would like to get the animations working, but it's not affecting functionality of my app at all.
A fix is available on latest master. Note https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href, but might be needed for retrocompat.
Just a small thing, not sure it's even worth a fix. I noticed that if I have an atom that is a dictionary, and a watch setup on that atom, I cannot use the watch as a function, like I could with a "real" dictionary.
#?(:clj (defonce !state (atom {:test true})) :cljs nil)
(e/def state (e/server (e/watch !state)))
(e/client (dom/p (dom/text (str (state :test))))) => fails with an error about state not being a function
(e/client (dom/p (dom/text (str (:test state))))) => succeeds
(e/client (dom/p (dom/text (str (get state :test))))) => succeeds
logged a bug, i think it's just an oversight