This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-07
Channels
- # adventofcode (4)
- # aleph (1)
- # architecture (9)
- # beginners (67)
- # boot (7)
- # boot-dev (12)
- # cider (3)
- # clojure (166)
- # clojure-austin (3)
- # clojure-estonia (1)
- # clojure-greece (2)
- # clojure-russia (5)
- # clojure-spec (1)
- # clojure-uk (4)
- # clojurescript (19)
- # cursive (1)
- # data-science (5)
- # datascript (4)
- # datomic (3)
- # docs (10)
- # emacs (24)
- # events (4)
- # fulcro (16)
- # graphql (8)
- # hoplon (2)
- # jobs-discuss (1)
- # leiningen (5)
- # off-topic (2)
- # planck (30)
- # re-frame (20)
- # reagent (36)
- # ring (3)
- # shadow-cljs (5)
- # spacemacs (1)
- # specter (2)
I’m using Fulcro 1.2.0. I’m puzzled about how to trigger a load action inside a post-mutation. It seems like the load-action is queued but not performed until the next transaction.
It seems like the remote part of a post mutation is not called, so the “(df/remote-load env)” is never setup for remote calling
Thanks for the very complete clarification. The need for a post-mutation arises for me because I’m using a custom client-side network component to manage requests to server rest api, but I think I’ll be able to do what you suggest in the response adapters I wrote. Thank you very much!
the remote side is not checked…you’re post-merge, so they are not transactions, they’re just data transforms.
The Om Next model used in 1.x makes running transactions from the merge phase (which is where post mutations happen) not a good idea
or consider this: why do you need one read to follow after another has finished??? If you can figure it out locally, then the server must also be able to do so if supplied the correct parameters
so, you can make a singe round-trip by issuing both loads “at once”, but with parameters so the server can figure out how to constrain the “second” one
You probably have logic like this: “Load X, then when I get that, look to see if I need Y…if so, load Y”…why not “Load X AND Y (with info about X, like the id of it)“…server uses parameters on load of Y to limit what gets returned.
The abstraction is still spelled out on the client, but the filtering work is just done on the server. Also has the advantage of being easier to reason about. The client logic is synchronous, local, and linear (not chained through mutations), and the server logic is the same (local to Y, based on local parameters).
Another approach is to define a query (via a query-only component that combines the final concern into the form you’d like) and parse that on the server to get back what you expect.
lots of ways to do it without introducing async behaviors that are hard to track down and debug
For anyone interested in true isomorphic apps with SSR using Nashorn (so js libs work): I’m working on a project and refined the development mode a lot more. I’m still refining it, but I’m ending up with something that works pretty well. The basics are:
1. Make the production build output to a .min.js
file, and dev to just .js
.
2. Run both a lein cljsbuild auto
on production, and the figwheel on dev
3. Have the server use the .min
build for SSR (required…nashorn can’t use the figwheel build)
4. Have the server modify the script tag so that in dev mode it sends a script tag for the figwheel code in index.html
This lets the server-side render work during development, but still gives you figwheel hot code reload.
I still need to make the server watch for timestamp changes on the .min file (to reset the Nashorn cached instance), but it’s working really well, and I’m using semantic UI React (js-only) lib with good results.
@tony.kay I'm interested in your SSR work.
The following line https://github.com/fulcrologic/fulcro/blame/develop/DevelopersGuide.adoc#L9582 should be (map->ChannelListener {})
fulcro.websockets.components.channel_server.ChannelServer
has a component dependency on :handler
but no mention is made in the DevGuide about this. It'd be great if you could talk a bit about component dep keys and possibly the differences in ring handler needs between websockets and regular requests. I would do it, but I got a bit too confused between the different approaches in the full template and the websockets demo.
Thanks for the very complete clarification. The need for a post-mutation arises for me because I’m using a custom client-side network component to manage requests to server rest api, but I think I’ll be able to do what you suggest in the response adapters I wrote. Thank you very much!