This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-04-09
Channels
- # announcements (26)
- # asami (1)
- # babashka (7)
- # beginners (51)
- # calva (1)
- # cider (18)
- # clj-kondo (6)
- # clj-together (1)
- # cljsrn (4)
- # clojure (78)
- # clojure-australia (3)
- # clojure-europe (25)
- # clojure-losangeles (1)
- # clojure-nl (2)
- # clojure-serbia (4)
- # clojure-spec (23)
- # clojure-uk (19)
- # clojurescript (23)
- # community-development (13)
- # deps-new (1)
- # emacs (24)
- # figwheel-main (5)
- # fulcro (61)
- # graalvm (1)
- # honeysql (11)
- # jobs (1)
- # lsp (7)
- # malli (4)
- # meander (6)
- # membrane (3)
- # off-topic (10)
- # polylith (13)
- # quil (7)
- # re-frame (54)
- # reagent (18)
- # remote-jobs (2)
- # shadow-cljs (81)
- # sql (16)
- # tools-deps (12)
- # xtdb (10)
hey ! new version of re-frisk is here https://github.com/flexsurfer/re-frisk [re-frisk-remote "1.4.0"]
or [re-frisk "1.4.0"]
in this release ā¢ re-frame handlers statistics and usage statistics ā¢ show effects for events ā¢ list of mounted views with subscriptions (help with tree needed) ā¢ force update trace (really useful metric) (works only in re-frisk-remote, if you are interested in re-frisk implementation you are welcome š ā¢ improved subs graph ā¢ copy data to the clipboard
stats for my re-frame project by re-frisk db: 76 | fx: 200 | cofx: 4 | event: 742 | sub: 404 (91)
why render and force update is not in the re-frisk? because we need to patch reagent, but re-frisk UI also uses reagent, in that case traces will be flooded with re-frisk UI , this is solved in re-frame-10x, but i'm not sure this solution will work with shadow , i need to find more general solution
Why would it? IIRC re-frame-10x just ships the full Reagent code with its own codebase, and replaces the namespaces.
> MrAnderson is a dependency inlining and shadowing tool Yep. But you can do all that yourself.
What am I doing stupid here?
(defn point-canvas []
[:div.content
[:canvas#point-canvas.canvas
{:on-mouse-down (fn [e] (rf/dispatch [:point-click {:x e.nativeEvent.offsetX :y e.nativeEvent.offsetY}]))}]])
I'm just trying to get the location of the mouse click in the canvas into a points array in app-db.
The first time I click I get an empty points vector, the second time i click i get the first point location added. It's always 1 click behind.Not nearly enough information.
> I get an empty points vector
What do you mean by "get"? Where's that vector? What does :point-click
handler do?
the first click I see app-db :points
is [], then the second click I get the the location of the first click into :points
LGTM. If you create a repo with an MRE, I can take a look.
BTW it's better to use proper JS interop instead of e.nativeEvent.offsetX
. E.g. (.. e -nativeEvent -offsetX)
. And replace (fn [e] ...)
with (fn [^js e] ...)
to avoid problems during advanced compilation.
But it's not related to the behavior that you see.
oh! I was trying to do js interop and get compiler errors, but i was stupidly using just (.) and not (..)
there's nothing much in there, just draws a canvas and i want to get the points where they click. Cant see what I'm doing wrong.
One small thing in advance - I'm not sure what .lsp
dir there does, but you probably don't want to have it in a Git repo, given that it contains an SQLite DB.
^js
will let the compiler know that the related symbols in JS interop should not be mangled.
Otherwise, it might rename them and the code will stop working in a release build.
hmmm. not sure what it is, wonder if calva puts that in there, maybe something to do with the calvas language server stuff
Seems like you're hitting this: https://github.com/day8/re-frame-10x/issues/268
Also, look at the browser's JS console when you're developing - you have <buttton>
there, which is an invalid tag.
And when you add a sub that uses app-db
, that issue with re-frame-10x should simply go away.
Sure, np.
I've only really started looking at cljs in the last couple of weeks, so it's all still a bit new to me!
Some unsolicited meta-advice. If you eventually want to spend a lot of time in CLJS, try to build your knowledge from the bottom-up, not vice versa. Especially when you encounter issues. Otherwise, you may have a hard time resolving them.
Of course, it's not because of CLJS - it's relevant to any technology stack. The higher the stack, the harder it will be to solve issues with it. Re-frame is relatively high up on the stack (JS -> CLJS -> (React ->) Reagent -> re-frame), so much harder to learn the basics at the bottom from so high up, especially if your tower is wobbly.
And, of course, don't ignore the documentation. :) Re-frame has great documentation, shadow-cljs - just as well. In particular, that ^js
thing is described here: https://shadow-cljs.github.io/docs/UsersGuide.html#infer-externs
Just to add to the above - it's not to discourage you from posting questions - those are fine. :)
Yeah, I've found it honestly quite overwhelming coming into front-end stuff. I've been programming professionally for years but normally I'm doing either back end or systems stuff. Front-end is hard to see where to start.