This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-04
Channels
- # 100-days-of-code (1)
- # announcements (1)
- # beginners (51)
- # boot (1)
- # calva (1)
- # cider (16)
- # cljsrn (2)
- # clojure (52)
- # clojure-spec (19)
- # clojure-uk (8)
- # clojurescript (8)
- # events (1)
- # figwheel-main (8)
- # fulcro (57)
- # midje (1)
- # nrepl (10)
- # off-topic (38)
- # pedestal (4)
- # portkey (1)
- # reagent (3)
- # reitit (4)
- # spacemacs (8)
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: https://github.com/fulcrologic/fulcro-incubator/blob/master/state-machine-docs.adoc Workspace Demo (covered in docs): https://github.com/fulcrologic/fulcro-incubator/blob/master/src/workspaces/fulcro/incubator/state_machine_ws.cljs
@tony.kay the links seem to got broken, maybe the branch?
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: https://github.com/fulcrologic/fulcro-incubator/blob/feature/routing-experiment/src/workspaces/fulcro/incubator/routing_ws.cljs

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.
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
@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
(well I am using fulcro server to process the queries / mutations)
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 🙂
for now, it has not been problematic, you do need to wrangle some dependency errors but that’s about it
(ion’s have certain versions of libraries that may conflict with your dependency set)
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?
what do you use for migrations of schema for datomic cloud?
same 😞
@pvillegas12 You can use a compiler option to set variables, and then base your remote on that variable
@tony.kay are the compiler options these https://shadow-cljs.github.io/docs/UsersGuide.html#compiler-options?
(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