This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-24
Channels
- # adventofcode (6)
- # announcements (4)
- # aws (21)
- # babashka (36)
- # beginners (58)
- # calva (3)
- # cider (2)
- # clj-kondo (21)
- # clojars (3)
- # clojure (35)
- # clojure-dev (4)
- # clojure-europe (5)
- # clojure-nl (8)
- # clojure-uk (8)
- # clojuredesign-podcast (7)
- # clojurescript (10)
- # core-async (3)
- # data-science (2)
- # datomic (2)
- # defnpodcast (11)
- # duct (4)
- # figwheel-main (1)
- # fulcro (34)
- # graalvm (12)
- # graphql (4)
- # joker (14)
- # kaocha (1)
- # midje (1)
- # off-topic (5)
- # pedestal (1)
- # re-frame (3)
- # reagent (4)
- # reitit (1)
- # shadow-cljs (4)
- # testing (12)
I had the same issue on the public fulcro react native template, I also uncommented the code in shadow.edn to no avail
I had to show a video of it working from the youtube series when demoing it during a workshop
Hi. Does anyone have experience with fulcro-garden-css? I am a newbie to Fulcro and need to colocate CSS with my components. The instructions are kind of sparse. I would appreciate any code snippets of actual use...
If I want to run some async code, like getting an access token (which may involve a remote request to refresh an expired token), as part of the request process in the client, is it recommended to write my own remote client implementation? It looks to me like request middleware has to be synchronous.
@hadilsabbagh18 is the example snippet in the readme not enough? https://github.com/fulcrologic/fulcro-garden-css#usage
the inspect tools uses co-located styles https://github.com/fulcrologic/fulcro-inspect/blob/master/src/ui/fulcro/inspect/ui/network.cljs#L71
but it is on fulcro 2 at the moment, not the latest major version so there are slight differences in how the CSS is injected, but co-location at the component level is mostly identical
@codonnell correct request middleware needs to by synchronous, don’t do IO there
I would add a client side pathom resolver and do all the async stuff in there, here’s an example where i do that
https://gist.github.com/currentoor/23d248ac7dc10deeba9859131962629e
rest networking is a custom remote with a client-side pathom parser, in the post-file-to-alpr-api
resolver i do all my IO, you can conditionally do your token refresh in there (the same place you do your actual request)
since these resolvers can be async
I already have a fulcro server with a pathom parser server-side. Is there a way to connect them easily?
oh yeah if you have control of the server than just use that
make a mutation refresh-token
and call it before your other load/mutation
IO is sequential by default
I could do that, I suppose, but it feels silly to do that before every remote load/mutation. (Thanks for helping btw!)
you could add global-eql-transform
and prepend your remote transaction automatically
though you shouldn’t need to re-auth on every IO, i’d reconsider that
I'm using an auth library which automatically does the IO to refresh the token when necessary and just exposes a promise-returning get-access-token
function.
I can verify from the network tab that it's not refreshing the access token on every request; agreed that would be a bit crazy.
I will look into global-eql-transform
; thanks for the suggestion!
ah i see
you could also write your own comp/transact!
wrapper function, just calls the get-access-token
then calls comp/transact!
when the promise resolves
that’s probably the saner approach
Thanks @currentoor! That helped. Now i need to integrate semantic ui with custom CSS.
@hadilsabbagh18 what’s to integrate? just add a css tag in your HTML and classes to your dom elements (which we have a nice concise keyword literal syntax for)
(div :.ui.inverted.dimmer {:classes [(when printing? "active")]}
(div :.ui.loader))
and my pleasure
use the localized dom only when you want to use custom css, use the regular dom otherwise
i alias localized dom to ldom
and regular dom to dom
localized dom is slower
regular dom performs a bunch of backflips at compile time to give you the best possible performance