Fork me on GitHub

OK, so I’m very excited about this one: I’ve been mulling over state machines as a good addition to Fulcro for some time. There are many cases of user interface interaction where a good state machine would just be super handy, but I’ve never had the time to implement my ideas. Well, the time has arrived, and I think the result is pretty darn cool so far. My first experiments are very encouraging, and Fulcro lends itself very well to this kind of integration (via an add-on library). There’s nothing at all that needs to be changed/added about Fulcro, really…it’s already pretty much a giant state machine…app state is the state, though, and it’s up to you to organize it all, write mutations (your events and state manipulations), etc. The scheme I’ve come up with will go through a few more refinements, but it’s already quite capable, and I’ve got a login for demo that shows the promise. I’ve thrown it up in incubator, along with docs so you can follow along…I’ve defined a few concepts that make it much easier to write the state machine itself, and not have to talk anything about idents, etc. Have a look-see. It’s on a branch right now, but there is a workspace demo that is runnable: Docs: Workspace Demo (covered in docs):

🎉 32
👀 4

@tony.kay the links seem to got broken, maybe the branch?


ooops, really?


yeah, branch 😜


Fixed. Thanks!


Oh, and I didn’t mention it in the docs, but it automatically figures out how to refresh the UI, so no follow-on reads are necessary 🙂


I also did a model for some routing ideas I’ve had (but don’t have time to develop) if anyone is interested in play with those:

metal 4

The experimental routers stuff will compose…a really nice feature, and would allow bidi-like route interpretation to be built-in to the routers themselves…e.g. each router in a path “picks off” the elements of path that apply to it, and then try to pass the rest off to something “deeper” in the UI (by searching via the query)…so they don’t have to know anything about it…also lets you “query” the current route from UI state in the same manner…would also allow for refactoring of the app with “self healing” URI paths.


would also work for code splitting


anyway…I know a lot of ppl are interested in the UI routing/URI problem. I don’t have time to deal with that one, but for what it’s worth, there it is 🙂


@pvillegas12 yep :) on it. Writing docs now for the stuff I've got working


I would like to change the URL the fulcro app points to depending on the environment, how can I do this? From the book it is not clear how production configuration works


you mean away from /api???


@tony.kay I’m currently overriding the remote url in order to target a different port. In production, though, I want it to point to the ion api gateway


so localhost:3000/api vs api-gateway-url/api


@pvillegas12 you're using fulcro with Datomic ions? literally in the process of moving an app over, did you have any issues gettting it going?


I had no experience with clojure(script), aws or datomic, so that has been really the bottleneck 🙂 Apart from that, there have not been any hindrances. Once you get the big picture you change your architecture to satisfy that decision


eg. I separated the backend from frontend because of the ion direction


(I’m still not 100% if that is necessary though :))


yeah i'm coming from the opposite direction lol Tons of AWS experience, been using ions since they have been available, and have deployed a few production services with them. etc etc. but just haven't smushed a fulcro server into an ion yet lol


I’m not using a fulcro server, instead I’m using a ring handler


yeah i sort of like having a separate ui package


(well I am using fulcro server to process the queries / mutations)


and pushing all the assets to cloudfront, etc


but gonna start simple


yup, that’s my flow right now


if you stumble let me know 🙂


right, i gathered that hte fulcro server stuff was ring compatible so dropping it into an APIGW enabled ion "should" be straightforward 🙂


will do thanks 🙂


for now, it has not been problematic, you do need to wrangle some dependency errors but that’s about it


yeah that's part of ion fun lol


(ion’s have certain versions of libraries that may conflict with your dependency set)


they've wandered into applicaton server territory


but don't really do the stuff that classic one's do with dedicated classloaders etc


but haven't had too many problems, their spitting out all the conflicts is super helpful


@eoliphant are you also using datomic?


we had a variety


moving it all to cloud/ions


what do you use for migrations of schema for datomic cloud?


nothing at the moment 😞 I've been looking at forking and hacking conformity


@pvillegas12 You can use a compiler option to set variables, and then base your remote on that variable


:closure-defines in compiler settings


(using shadow)


shadow passes those through the the normal cljs compiler…as documented (some are controlled by shadow, but many are passed through)


quick question using a 3rd part react mapping lib (react-map-gl). and need to convert this <ReactMapGL {...viewport} onViewportChange={updateViewport}> to the appropriate fulcro stuff, I tried something like this (ui-react-map-gl (prim/computed viewport {:onViewportChange #(prim/transact! this [(api/update-viewport {:viewport ~%})])})` but that's not quite doing it 🙂 I created (ui-react-map-gl) via the component factory stuff in the incubator