This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-14
Channels
- # atom-editor (5)
- # babashka (6)
- # beginners (29)
- # calva (16)
- # cider (1)
- # clj-kondo (20)
- # cljs-dev (44)
- # clojure (29)
- # clojure-europe (19)
- # clojure-nl (8)
- # clojure-norway (7)
- # clojure-spec (2)
- # clojure-sweden (1)
- # clojure-uk (56)
- # clojurescript (32)
- # code-reviews (30)
- # conjure (24)
- # cursive (49)
- # datomic (4)
- # fulcro (31)
- # helix (3)
- # instaparse (4)
- # kaocha (100)
- # lambdaisland (2)
- # mid-cities-meetup (1)
- # monads (1)
- # off-topic (42)
- # pathom (13)
- # pedestal (6)
- # portal (5)
- # re-frame (6)
- # reagent (9)
- # reitit (11)
- # remote-jobs (1)
- # rewrite-clj (11)
- # shadow-cljs (44)
- # sql (22)
- # tools-deps (13)
- # uncomplicate (1)
- # xtdb (15)
I can't quite seem to figure out what ERROR [com.fulcrologic.fulcro.routing.dynamic-routing:454] - More than one route target on screen of type function ...
is trying to tell me. It's coming from (dr/change-route! app path)
, but it's never being passed an ambiguous path.
Hm, yeah, the message means more than one thing currently mounted on-screen (of the same type) is about to get a will-leave
message, but I can’t remember why that;s a problem 😕
well, let’s assume they are two different editors of the same kind of thing. One might be ok with leaving, and the other not…but even if they give different answers, it is an instance-centric call, so I’m not sure what the problem is
Hello
I started to move the realworld app
into Fulcro RAD
Fulcro RAD is awesome. Thanks @tony.kay
https://github.com/souenzzo/eql-realworld-example-app
In rad is there a way to add a placeholder to a field ? I have gone through the com.fulcrologic.rad.form-options
, but dont see a way to do that.
That would be part of a given rendering plugin. the SUI rendering plugin does support custom props on some inputs, but you’ll have to use the source. Not well-documented yet.
I don’t think I have it set up for text inputs, but I should…you could send a PR by copying that pattern into the control you need it for
doing it here would get it to work on most things, I think, since this is a oft-used helper: https://github.com/fulcrologic/fulcro-rad-semantic-ui/blob/develop/src/main/com/fulcrologic/rad/rendering/semantic_ui/field.cljc#L14
::form/field-style-configs { :my/prop {:input/props {... raw extra props to set on input ...}}}
This was already mentioned in the docstring of field-style-configs as an optionally-supported thing, and now has a bit wider support for SUI at least
When updates to the app state are local (network is not involved), one can directly modify the state atom, even use utilities like merge-component
. Is it more idiomatic to defmutation
nonetheless? At least, the mutation is centralized if one day the network becomes involved, I guess refactoring becomes a lot easier. On the other hand, meanwhile, would defmutation
+ transact!
imply an unnecessary overhead?
@UCFG3SDFV for simpler ones, you can use fm/set-value! helper Complex mutations needs a name. it will be used for debug, remotes and other stuff.
Could you expand a bit on "needing a name" please?
(disclaimer: I am new to Fulcro)
I tend to write (`action)` into a separate fn, so a basic defmutation
which does not need any remote simply has a short action
body acting as a proxy call to its separate fn. Would it still be useful to keep doing that instead of swap!
ing on the state atom straightaway?
as you do (defn action [params] ....body...)
You will do (defmutation action [params] ...body...)
And where you did (swap! state action params)
you will do (comp/transact! this action params)
You can just swap! the atom state inside the mutation, the mutation can't be just it
Mutation include for example, "from where" the transact
was invoked. you can use this ref
erence to do more generic mutations
Touching the state atom circumvents all rendering logic. You are allowed to do it, but then you’re “out of the model”. In general, you want mutations or UISM.
I see, one big benefit I understand from this is the access to the env, indeed.
@tony.kay Oh, right, Fulcro does not watch the state atom if I recall correctly. So only utilities like merge-component!
would be useful then.
adding to what others said, transact!
also has some helpful options like :after-render?
that you wouldn't get with a direct swap!
Any hints on getting the fulcro-rad-demo working with VSCode and Calva? I got it all working using the terminal, but can't seem to make it work with VSCode for repl integration. When I try to jack in with Clojure CLI + shadow-cljs it just hangs with the message "Jacking in..."
have you tried jacking in with just shadow-cljs?
Just using shadow-cljs gets me jacked into the cljs repl and the build runs with no issues. I don't have a clj repl to start the server from though. The shadow-cljs watch is good, but no luck on the clojure cli + shadow-cljs I would expect to work so I can start the server.
I notice that load!
does not actually log a diff in the transaction log (state before/after are the same). Then the next transaction has its "State before" include the thing that was loaded. Is this expected behavior?
Ok, so I figured out the problem, but not the solution, with the duplication thing.. it turns out the state is actually incorrect: what appears to be a correct, unique :entry/id
(list item) actually has the rest of its state (and therefore props to be rendered) conflated with other :entry/id
s! I can only guess that this is on account of some dynamic query weirdness. It only happens when pathom isn't being hit. Is something wrong with my logic in :will-enter
?
:will-enter (fn [app {:view/keys [id]}]
(let [view-id [:view/id (uuid id)]]
(if (get-in (current-state app) view-id)
(dr/route-immediate view-id)
(dr/route-deferred
view-id
#(df/load! app view-id View {:post-mutation `dr/target-ready
:post-mutation-params {:target view-id}})))))