This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-29
Channels
- # beginners (18)
- # boot (1)
- # cider (12)
- # clojure (18)
- # clojure-russia (5)
- # clojure-uk (8)
- # clojurescript (17)
- # cursive (7)
- # datomic (10)
- # editors (1)
- # figwheel-main (14)
- # hoplon (2)
- # hyperfiddle (1)
- # keechma (2)
- # leiningen (25)
- # off-topic (5)
- # onyx (3)
- # reagent (53)
- # reitit (6)
- # shadow-cljs (14)
- # spacemacs (3)
- # tools-deps (14)
- # uncomplicate (12)
I’ve SSR’d re-frame just fine on NodeJS. I had a whack at nashorn once, but it was horribly hard to get right.
Since I’m exploring Ions at the moment, I’ve gone with Rum for now, for SSR. On Ions, there’s no way to run nodejs that I’m aware of.
hi everyone. is there a reason why on-drag-end
wouldn’t work unless I don’t drag over different items? basically if I just click on an item and if I don’t change the position at all, then it fires
If I create a ratom and then refer it in the component, now when I reset the value of the atom, how internally does reagent figure out which component is derefing that atom and refresh it ?
@rnagpal reagent sets a dynamically bound variable before running the render function. the implementation of ratom/deref
looks at that variable and adds the component to the watch list
look at the usages of this variable: https://github.com/reagent-project/reagent/blob/5693716a7559a4f31bf2baf85378b3394a54e84e/src/reagent/ratom.cljs#L9
(defn- notify-deref-watcher! [derefed]
(when-some [r *ratom-context*]
(let [c (.-captured r)]
(if (nil? c)
(set! (.-captured r) (array derefed))
(.push c derefed)))))
I think c
is the component and derefed
is the atom. the nil-check is to see if this component has already derefed other atoms, and if not, create an array of atoms
the code is crazy confusing because it does all this caching by setting properties on itself
but from this I understand that
IDeref
(-deref [this]
(notify-deref-watcher! this)
state)
this
id the Ratom itselfCan you please point me to the line, where reagent know which component
derefs
an ratom
the only way to understand what reagent is doing is to treat it as a black box, create some experiments, and add some print statements
Who is the maintainer of the project ? I would love to add docs, if someone can review and merge it everynight
juho does most of the work, but there are several contributors. the original author disappeared around 2016. i don’t know what happened to him. several of us contribute to docs and more help would be welcome. doc PRs are welcome and are usually merged within a couple of days
Cool. Thanks @lee.justin.m
it’ll be nice to have async Rendering and suspense built in to react so we can all ditch reagent 😉
yeah. I actually decided to eschew reagent and just use plain react with add-watch last night
ran into lack of cursors right away. added a “should-update” that at least saves some renders, but reagent does do a lot to try and squeeze performance out of the paradigm
part of me wonders if a light react wrapper + a redux implementation would get you a lot of what people like about re-frame without the mountainous heap of complexity
i’m not so sure auto-watching is really all that useful. it isn’t hard to declare your subscriptions up front
i also don’t think there is that much utility in the magic of form-1 and form-2 components
as someone who has onboarded (well, still kind of in the process) an entire team to reagent, I can say that the ratom (and especially form-2) components are confusing as hell
@rnagpal it looks like this is where those atom derefs are captured: https://github.com/reagent-project/reagent/blob/5693716a7559a4f31bf2baf85378b3394a54e84e/src/reagent/impl/component.cljs#L135
@lee.justin.m I agree, I think that using atoms as state containers is nice because it’s very Clojure-y, but I also think that being explicit about what you’re tracking is better
I cannot seem to find the reference docs on Reagent’s hiccup syntax. Best I’ve found is this random (but concise) reddit comment: https://www.reddit.com/r/Clojure/comments/75d054/hiccupreagent_syntax_help/do5o0qh Are there any other goodies that I’m missing out on?
Thanks @lilactown for helping. Going through that part