This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-10
Channels
- # 100-days-of-code (2)
- # adventofcode (188)
- # aleph (3)
- # announcements (2)
- # beginners (76)
- # boot (3)
- # braveandtrue (49)
- # cider (82)
- # clara (15)
- # clojure (101)
- # clojure-europe (4)
- # clojure-india (3)
- # clojure-italy (26)
- # clojure-kc (1)
- # clojure-nl (4)
- # clojure-norway (1)
- # clojure-russia (5)
- # clojure-uk (33)
- # clojurescript (32)
- # crypto (20)
- # cursive (34)
- # datomic (45)
- # emacs (3)
- # events (1)
- # figwheel (1)
- # figwheel-main (10)
- # fulcro (30)
- # graphql (14)
- # hoplon (12)
- # hyperfiddle (21)
- # jobs (11)
- # kaocha (7)
- # klipse (8)
- # leiningen (10)
- # luminus (3)
- # nrepl (18)
- # off-topic (232)
- # onyx (8)
- # pathom (6)
- # re-frame (30)
- # reagent (3)
- # reitit (6)
- # remote-jobs (3)
- # ring-swagger (4)
- # shadow-cljs (21)
- # spacemacs (5)
- # sql (18)
- # tools-deps (23)
- # yada (2)
hey @tony.kay did you ever get the new workspaces demo back online? It seems broken here: https://github.com/fulcrologic/fulcro-incubator/blob/develop/dynamic-routing.adoc#full-example
ah so this is for the source — I thought there also was a running workspaces example on github pages
Trying out the router example, seeing this warning:
[ 7.575s] [fulcro.incubator.ui-state-machines] Attempt to get an ASM path [:fulcro.incubator.ui-state-machines/local-storage :pending-path-segment] for a state machine that is not in Fulcro state. ASM ID: :RootRouter2
Still works, but is this a mismatch b/w router and state machine behavior?Do I place not changing values, like the label of something, in props
or in computed
? What would be best practice?
And if I put them in computed
, how do I tell workspaces, that my component should have these computed values?
@mroerni usually computed is for thing you don't control, when you use computed you are most of time delegating the control of it to a parent, while things on query the component will have direct control, its more about how you organize your things, if want that kind of control in workspaces you can use a custom Root, so you can provide anything you want, a lot of times when I need that I just write a new component (regular with ident, not a root) and wrap it just to create the card
The use case is building on the state-machine example to route to the app once login is successful. I guess dr/change-route
is impossible inside the handler because we don’t have access to this
, should I use dr/route-immediately
or is some other pattern preferred?
That’s my bad…there should be a helper that lets you update app state for routes so they can be used in UISM
I’ll have to think about that, though…the router supports side-effecting for deferred routes.
at the moment you’d have to “cheat” and save the app or reconciler in a top-level atom so you can get to it.
you could also store/retrieve the reconciler as event data, but if you do that be sure to put the reconciler itself in metadata so it doesn’t hose your app state…e.g. (uism/store env :reconciler (with-meta {} {:r reconciler}))
and (-> env (uism/retrieve :reconciler) meta :r)
I didn’t save either the app or reconciler, but just saved the login result from the uism in a global key, and exited without routing anything. In the defsc-route-targets, I put checks against the global key and reroute there. Is this OK, you think?
My (app/login {:user 123 :pass 321})
"returns" {:user 123 :authed? true}
(on server)
On client, I optimistically redirect the user to the "home"
How can I handle it back to login page case app/login
returns false
?
It's something like "call me to merge this response"
@souenzzo I guess you and I have similar problems. I decided to just save the result of the login mutation in the client db (something like (assoc-in state [:globals :session :logged-in?] true)
and tie the redirect to the value of that. I guess you can optimistically set that to true
and overwrite it with the return value of app/login
as well.
I think you’re looking for pessimistic mutations maybe? https://github.com/fulcrologic/fulcro-incubator#pessimistic-mutations
client sends [(do-stuff)]
server respond {do-stuff {:foo 33}}
client take the response and do something with this response <<< HERE!
yeah, returning should be the defsc symbol for the kind of thing you’re dealing with, and there’s also m/with-target
@souenzzo did you see this section? http://book.fulcrologic.com/#ReturnValues