This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-07-03
Channels
- # announcements (1)
- # babashka (22)
- # beginners (176)
- # calva (10)
- # cider (4)
- # circleci (5)
- # cljsrn (20)
- # clojure (28)
- # clojure-europe (11)
- # clojure-italy (5)
- # clojure-nl (5)
- # clojure-spec (1)
- # clojure-sweden (2)
- # clojure-uk (29)
- # clojuredesign-podcast (4)
- # clojurescript (38)
- # code-reviews (25)
- # conjure (1)
- # core-typed (1)
- # data-science (16)
- # datomic (23)
- # figwheel-main (16)
- # fulcro (48)
- # helix (9)
- # jobs (3)
- # juxt (5)
- # kaocha (17)
- # malli (19)
- # mount (9)
- # nrepl (4)
- # off-topic (35)
- # pathom (7)
- # re-frame (28)
- # reagent (26)
- # reitit (1)
- # releases (1)
- # remote-jobs (5)
- # sci (6)
- # shadow-cljs (36)
- # spacemacs (3)
- # sql (8)
- # tools-deps (13)
- # unrepl (1)
- # vim (4)
- # xtdb (8)
hi, I’m following the videos to learn fulcro 3.0, right now I’ve just finished the video 5: how rendering works
https://www.youtube.com/watch?v=JBy_htHxygo&list=PLVi9lDx-4C_T7jkihlQflyqGqU4xVtsfi&index=5
I downloaded the code for the tag
and when I tested it with the fulcro version in the example it works as in the video
but if I upgrade the fulcro version the rendering is “broken” and now it render all the “parents”
The default renderer has been changed so that could explain it. It is now the multiple-roots-renderer
, which mostly behaves just like the old keyframe-render
. Perhaps the older Fulcro version uses the ident-optimized-render
, which only renders components with changed data, based on their ident. This has better performance but leads to rendering troubles when Fulcro cannot figure out some dependencies (and does does not re-render something you want it to). For most cases, the multiroot is good enough and simpler.
got it, thanks @holyjak
is this something expected from this new versions?
@tony.kay regarding the :pre-merge
example in http://book.fulcrologic.com/#_initial_state_2 - I like it simplicity but it turns out that if only works if (1) either you use :ui/*
for the router property or (2) you make sure to omit Fulcro's not-found
from the data tree (otherwise you end up with :my/router :com.fulcrologic.fulcro.algorithms.merge/not-found
in the data-tree
, which overrides whatever is in the initial state).
So perhaps it is better (i.e. less error-prone) to explicitly set the router state:
:pre-merge (fn [{:keys [data-tree]}]
(assoc data-tree
:settings/panes-router
(comp/get-initial-state SettingPanesRouter)))
What do you think? Should I send a PR for this?Hello, I am writing a post about possible approaches to error handling in Fulcro. Feedback would be most appreciated!
https://gist.github.com/holyjak/a70947d6618c79279c68cc08f948603e
@tony.kay I am encountering a Catch-22 problem here. I must add :pc/errors
to my queries (together with Pathom's p/raise-errors) yet I don't need/want to send it to the backend since Pathom would turn all into :p/not-found
(and possibly later into actual error maps, if any). I assume I could remove them from the backend query via :global-eql-transfrom
. Is this a correct approach? If so - why does RAD use this transform to add :pc/errors to the query ? Thank you!
Is it possible to to a reverse lookup in a defsc query? What my situation is is I have a :notification/triggered-by
that points to an :account/id
. And I have a :company/primary-account
that also points to :account/id
. Now I want to, starting from having :notification/id
, reach :company/id
.
Hmm, I just tried that and got nothing... I guess I could just write a resolver for the reverse case
I often replace :user/_company in the resolver with :company/user. That gives me readable backlinks in the normalized db.
I am using Fulcro RAD Datomic, no idea if it does create reverse resolvers. Apparently not, because adding :company/_primary-account
returned nothing.
Hm. While we're at it, do you know if there's a way to make the ::pc/output
being "or" instead of "and"? As in, when I give it #{:company/id :vendor/id}
to name an example, that i mean either the first or the latter, instead of both
Hmm. Ich glaube Du fragst immer nach beiden und bekommst halt nicht zurück was er nicht findet. Im Output heißt das ja nur, dass er es Dir gibt, nicht, dass er es garantiert.
Nein, so wie ich das gesehen habe, benutzt Pathom einen Resolver nur dann, wenn es alles, was ins ::pc/input
gehört, hat
Ding/id muss er kennen. Und dann schaut er ober dir Ding/Name und Ding/Adresse geben kann.
Genau, aber es gibt wohl keine Möglichkeit, zu sagen, "als Input akzeptiere ich entweder a/id oder b/id"?
Ansonsten gibt es noch sowas wie "Alias" oder so ähnlich, wenn sich das eine aus dem anderen ableiten läßt.
Oder es werden drei Resolver, das gemeinsame in einem und zwei kleine, die zum großen überleiten.
Ja, ich habe ein paar Attribute, die ich an mehrere verschiedene "Tabellen" anhängen kann, und ich dachte, ich könnte da vielleicht einen Resolver für alle schreiben ^^ Na, ist ja nicht viel Overhead.
i'm using slugs instead of ID's in my routes, but a problem I'm running into is that I need to use the ident in my :will-enter
, but I don't have it yet because the load (which will give me the ID and other data based on the slug). i could just make the slug my ident, I guess, but is there a way I could handle this without doing that? (posting code as a reply to this)
here's the code I have so far:
(defsc ProjectDetail
[this {:project/keys [id name slug] :as props}]
{:query (fn [_] [:project/id :project/name :project/slug])
:route-segment [:project/slug]
:ident :project/id
:will-enter
(fn [app {:project/keys [slug] :as route-params}]
;; we know the slug, but...
(when slug
(dr/route-deferred
;; we need to put the ident in here and below in the :post-mutation params
[:project/id ???]
#(df/load! app [:project/id ???] ProjectDetail
{:post-mutation `dr/target-ready
:post-mutation-params {:target [:project/id ???]}}))))}
the closest I've gotten is reading the ID I need directly from the application db:
(when-let [id (->> app
::app/state-atom
deref
:project/id
(filter (fn [id {:project/keys [other-slug]}] (= slug)))
first
first)]
This works OK as long as I make sure that data's actually been loaded. But this code kind of stinks, right? is app
actually meant to be used this way?i'm reluctant to do it because it'd ruin some symmetries, but in the absence of any other approach that might be the way to go
you could potentially have this component be "light" and just be used to translate from slug to id and then have it render a component that uses project/id