Fork me on GitHub
#fulcro
<
2019-12-24
>
Adrian Smith13:12:06

I had the same issue on the public fulcro react native template, I also uncommented the code in shadow.edn to no avail

Adrian Smith13:12:36

I had to show a video of it working from the youtube series when demoing it during a workshop

mruzekw16:12:55

@sfyire Try downgrading socket.io-client to ^1

hadils17:12:41

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...

hadils17:12:28

Do I create a special component to hold my CSS?

Chris O’Donnell18:12:09

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.

currentoor19:12:15

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

currentoor19:12:37

@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)

currentoor19:12:04

since these resolvers can be async

Chris O’Donnell19:12:57

I already have a fulcro server with a pathom parser server-side. Is there a way to connect them easily?

currentoor19:12:38

oh yeah if you have control of the server than just use that

currentoor19:12:10

make a mutation refresh-token and call it before your other load/mutation

currentoor19:12:16

IO is sequential by default

Chris O’Donnell19:12:36

I could do that, I suppose, but it feels silly to do that before every remote load/mutation. (Thanks for helping btw!)

currentoor19:12:58

you could add global-eql-transform and prepend your remote transaction automatically

currentoor19:12:20

though you shouldn’t need to re-auth on every IO, i’d reconsider that

Chris O’Donnell19:12:15

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.

Chris O’Donnell19:12:32

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.

Chris O’Donnell19:12:01

I will look into global-eql-transform; thanks for the suggestion!

currentoor20:12:19

you could also write your own comp/transact! wrapper function, just calls the get-access-token then calls comp/transact! when the promise resolves

fulcro 4
currentoor20:12:51

that’s probably the saner approach

hadils21:12:00

Thanks @currentoor! That helped. Now i need to integrate semantic ui with custom CSS.

currentoor21:12:10

@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)

currentoor21:12:43

(div :.ui.inverted.dimmer {:classes [(when printing? "active")]}
  (div :.ui.loader))

currentoor21:12:59

and my pleasure

hadils21:12:15

How does dom differ from localized-dom?

currentoor21:12:05

use the localized dom only when you want to use custom css, use the regular dom otherwise

hadils21:12:13

Ok, thanks.

currentoor21:12:31

i alias localized dom to ldom and regular dom to dom

currentoor21:12:40

localized dom is slower

currentoor21:12:25

regular dom performs a bunch of backflips at compile time to give you the best possible performance