Fork me on GitHub

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!

👏 28
bananadance 8

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


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


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?


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


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


so in a mutation?


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


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


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


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


it’s all just state manipulation


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


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


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


no need to mess with the query


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


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.


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


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


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


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


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


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


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


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


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


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


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


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 🙂


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


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 🙂


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.


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.


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


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


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


@U06QS81LM There is the new dom, that is similar to hiccup


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


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


In the book there is a mention of react native


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.


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


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


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

☝️ 8

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


ah really, that’s good to know.