This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-01
Channels
- # beginners (117)
- # boot (8)
- # cider (22)
- # clara (3)
- # clojure (79)
- # clojure-italy (3)
- # clojure-spec (34)
- # clojure-uk (34)
- # clojurescript (74)
- # cursive (7)
- # datascript (5)
- # datomic (28)
- # defnpodcast (1)
- # dirac (9)
- # docker (25)
- # duct (1)
- # emacs (14)
- # fulcro (67)
- # graphql (1)
- # hoplon (15)
- # jobs (4)
- # juxt (6)
- # off-topic (76)
- # parinfer (3)
- # re-frame (25)
- # reagent (4)
- # rum (6)
- # shadow-cljs (1)
- # spacemacs (30)
- # sql (15)
- # unrepl (36)
- # yada (1)
@levitanong So, I’m playing with react-motion right now, and I don’t see it failing with or without the rebindings. Not sure why…it just seems to work for me out of the box.
I guess I can go ahead and release the macro. It at least doesn’t break anything, and it does make sense that the bindings could get lost…so, I’d appreciate feedback about where it is needed and where it isn’t; otherwise I don’t know what to say in docs. I’ll push this demo app to github for anyone to play with.
I just added a port of their draggable balls demo as well…just pushed the source and an update to the live version online.
So, in general it just seems to work…that macro hasn’t been needed in anything I’ve coded yet.
The main pain is just native js interop…e.g. using gobj/get instead of being able to do nice destructuring.
Fulcro 2.1.5 released. Includes the with-parent-context macro, and fixes load
to work properly with dynamic queries. load
now can accept a factory (in lieu of a class) for when you’re using dynamic queries.
hi @tony.kay sorry for the late reply. Lemme clarify: ReactTransitionGroup contains two APIs: Transition and CSSTransition. The latter is the easy thing because it doesn’t take a function as a child.
“Are you basically asking how you can use functions as a child?” <-- yes, exactly this.
Will take a look at the things. 😄
@tony.kay there is a potential gotcha with with-parent-context
. When I implemented it for my project, the CLJ side was complaining because the dynamic vars were private. So I had to do the (:ns &env)
check to see if the macro was being called in cljs or clj. If clj, I just skip it all and
`(do [email protected])
Wicked awesome demos though 😄
Ah, I did not try it in cljc, but it should be ok since it is now in the right place for private use
@levitanong I could not find a scenario where I needed it, though. Are you doing something with native or something?
@tony.kay I’m working with web. The usecase is when i’m trying to do SSR
haha sorry
it’s something that’s just always at the back of my mind
I use a reader conditional to turn react-motion or react-transition-group to divs when in :clj
(defmacro with-fulcro-vars
"These should match the 'render' case in reshape-map.
Possible gotcha in SSR context."
[component & body]
(if-not (:ns &env)
`(do [email protected])
`(let [this# ~component
reconciler# (or fulcro.client.primitives/*reconciler* (fulcro.client.primitives/get-reconciler this#))
depth# (or fulcro.client.primitives/*depth* (inc (fulcro.client.primitives/depth this#)))
shared# (or fulcro.client.primitives/*shared* (fulcro.client.primitives/shared this#))
instrument# (or fulcro.client.primitives/*instrument* (fulcro.client.primitives/instrument this#))
parent# (or fulcro.client.primitives/*parent* this#)]
(binding [fulcro.client.primitives/*reconciler* reconciler#
fulcro.client.primitives/*depth* depth#
fulcro.client.primitives/*shared* shared#
fulcro.client.primitives/*instrument* instrument#
fulcro.client.primitives/*parent* this#]
[email protected]))))
my version looks like this
this way, it “fails” silently in a CLJ context
oh right
silly me
it never has to!
because you’re the one doing it, and not me!
The implication of this only hit me now. lol
… that’s odd.
java.lang.IllegalStateException: var: fulcro.client.primitives/*reconciler* is not public
and it’s highlighting my use of prim/with-parent-context
i mean I guess I could always do
#?(:cljs (prim/with-parent-context this (something))
:clj (something))
hurrah!
I went ahead and made those dyn vars public. There are extension reasons ppl might want access to them. but, I mainly just adopted your macro.
Oh, but if you made them public, would there be a need to use my macro?
or is the decision to use the macro based on the fact that it isn’t needed in CLJ
ah, i meant the bit with the (:ns &env)
not the entire macro. Sorry, i was loose with my language
okay got it
will try it out now 😄
@tony.kay works like a charm! thank you 😄
@levitanong So, I never did quite understand where you need the bindings. All of my trials of the function as a child pattern work without the wrapper
I'd like to write something up in the dev guide, but I'd like to have a use-case where you actually need it
@tony.kaysorry for the late reply. The most common situation is when you transact!
from a view that has been transitioned.