Fork me on GitHub
#fulcro
<
2018-04-04
>
wilkerlucio00:04:06

Hello, [com.wsscode/pathom "2.0.0-beta3"] is out! This versions adds async parsers as a core feature of pathom, this gives reach for Javascript environments, where async operations are norm, now the async parser allows you to return core.async channels and will handle the ordering properly, all current features support async (profiling, error catching, connect...). This release is also about robustness, the query generators were improved and know are very flexible in allowing customisations around how the generated queries should look like (and are much faster), many bugs on corner cases were found and fixed thanks to some new generative tests. Docs were added for the new async parser are available, docs for query generation are in progress. Thanks! https://github.com/wilkerlucio/pathom

bbss02:04:06

@tony.kay I see. set-query! doesn't work a second time. And if I inspect in the callback with a print before and after the set-query! it seems not reflected, even when I pass @state to get-query in the print.

bbss03:04:46

And passing :reconciler-options {:render-mode :brutal} to the client does not seem to change that.

bbss03:04:14

Okay, I was looking at the wrong callback, doh, actually passing @state to the get-query seemed to solve this. So my guess is the dynamic var is not bound. Anything I can check to make sure the dynamic var gets bound?

tony.kay03:04:58

@bbss so, it depends on when you’re calling get-query, and from where. In normal composition (within the query of the component) it should be fine. If you’re trying to use get-query outside of that (e.g. in a mutation), then you have to pass the state map.

bbss03:04:41

Okay, that makes sense, and yes, I'm using it to update the query for set-query!

tony.kay03:04:52

so in a mutation?

bbss03:04:53

Hmm, no, just in a callback. The thing I'm changing is just react local state.

tony.kay03:04:17

I see, so set-query! is a mutation…I guess we could use an update-query! eh?

bbss03:04:38

Yes, that would be what I'm doing effectively.

tony.kay03:04:46

there is a helper function set-query* (I think it is called) that can be used in a mutation, which would let you read/write it in one place

tony.kay03:04:58

it’s all just state manipulation

tony.kay03:04:40

sorry the book is so light on this topic…nobody has been using it, so I haven’t really documented it much

bbss03:04:42

I'm doing it quite deep into the query though, that might not be the usual way, but I have a really big game "observation" object that I need to pull something from deep within. So not actually making UI components for everything in that tree

tony.kay03:04:26

you know you can just pull that “blob” in as a big denormalized map into your component, and have helper functions that just pull out your stuff

tony.kay03:04:29

no need to mess with the query

tony.kay03:04:47

it’s perfectly fine to have a denormalized map of stuff that acts as a “value”

bbss03:04:19

Hmm yeah but it's not exactly a singleton, it belongs to a run which runs on a process and there can be many of them.

bbss04:04:19

So I feel it benefits from being part of the normalization.

bbss04:04:47

I am probably going to manually clean-up the observations after a run finishes to keep it performant.

bbss04:04:33

Although I'm pretty happy about performance so far. Browser and fulcro are more powerful than I might have expected.

tony.kay04:04:24

ok, glad you’re finding that it is working well.

bbss04:04:46

Yes, and thank you for being so patient with my many questions. 😄

troglotit08:04:55

Hey! I was wondering if there’s any shadow-cljs & fulcro examples? Without release jars, to use it as a SPA-skeleton

claudiu09:04:04

@troglotit have you tried the lein-template ? It has shadow-cljs & a small demo, + a nice setup 🙂

troglotit09:04:51

yeah, I tried. Frankly, I’m being lazy, but I used lein template and shadow-cljs+reagent example, and seems like it’s working.

troglotit09:04:53

I’m a more of a frontend engineer, so most of the time I just want static html+js+css files, and that lein template didn’t provided that

troglotit09:04:08

But I’ve been reading/following about clojure for ~1.5 years, and project bootstrapping did get me around 5 hrs 😕

claudiu09:04:00

ahh got it 🙂 it's pretty easy to remove the backend code and just use the html. 🙂

claudiu09:04:14

if you want to use the fulcro template without the backend seems to me like all you have to do is npx shadow-cljs watch main and it will just use the resources/index.html 🙂 for getting started the backend code should not be a problem, just dead weight that can be removed 🙂

troglotit09:04:46

Excuse me, anyway, if I did sound like entitled lazy programmer. And thank you for your help 🙂

claudiu09:04:49

You're welcome. Also a bit lazy, finding templates is also my starting point, although cljs isn't as rich as javascript in terms of starter-kits. But at least after you get everything working it's really nice 🙂

terjesb09:04:46

Is it possible to run the fulcro-template app in a card? I tried (reset! fulcro-template.ui.html5-routing/use-html5-routing false) and adding (defcard-fulcro template-app fulcro-template.ui.root/Root {} {:inspect-data true}) and it shows the header and a signin button, but not the rest of the login ui, and the i18n toggler doesn’t work.

claudiu10:04:18

@U0523NZUF no idea. There is an example here of placing the root component http://fulcro.fulcrologic.com/tutorial.html#!/fulcro_tutorial.F_Fulcro_Client

claudiu10:04:17

seems like :fulcro key is where you place stuff like starter-callbac and i18n seems like it has to be added in the :reconciler-options for it to work.

cjmurphy13:04:42

re-frame has a starting point for react native development called 're-natal'. Does Fulcro have an equivalent, or something I can point to? Also does anyone have experience developing React Native applications using Fulcro (or Om Next or qlkit for that matter)?

luposlip13:04:47

And can hiccup be used for frontend (as is the case for reagent/re-frame)?

eoliphant13:04:16

I don’t think you can use hiccup. Fulcro is ‘om-next: pretty much finished’ and depends on that tooling

claudiu13:04:26

@U06QS81LM There is the new dom, that is similar to hiccup http://book.fulcrologic.com/#AlphaDOM

wilkerlucio13:04:53

re-natal is not re-frame specific, they even had a template starting with om-next

wilkerlucio13:04:17

but today I think using shadow-cljs is the way to go for react native, that's a special place where you want the most NPM you can get

claudiu13:04:21

In the book there is a mention of react native http://book.fulcrologic.com/#_useful_reconciler_options

luposlip13:04:33

Thanks @U380J7PAQ, @U3LP7DWPR and @U066U8JQJ. Do you know if someone has actually used re-natal with Fulcro, or made React Native (mobile) apps with Fulcro in any other way? Coming from reagent/`re-frame`/`re-natal`, there's lots of stuff I'm used to, that I might miss if no alternative is (readily) available when evaluating Fulcro.

wilkerlucio13:04:55

@U06QS81LM I made a few experiments in the past, it worked fine for a initial screen, but I didn't went much further, I'm currently creating an app with fulcro + shadow-cljs, the main issue I found was trying to integrate some js routing libraries, because they work in such a stateful way, also shadow doesn't support a "hot-reload" mode for RN code (although you get the RN auto-reload, which works but is not as good)

luposlip13:04:16

So no figwheel auto-reload (either with normal browser webapp and/or RN mobile app)?

tony.kay14:04:10

Hot reload works fine with figwheel and shadow on browsers. The comment was about shadow+native i think

cjmurphy06:04:26

@U380J7PAQ: hiccup works no problem with Fulcro or Om Next or whatever, Just write your hiccup and use the html function to turn it into dom. You could surround every render with (html ...) if you wanted.

eoliphant14:04:47

ah really, that’s good to know.