This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # beginners (145)
- # boot (19)
- # calva (61)
- # cider (33)
- # cljs-dev (15)
- # cljsrn (16)
- # clojure (35)
- # clojure-dev (39)
- # clojure-russia (2)
- # clojure-spec (10)
- # clojure-uk (7)
- # clojurescript (5)
- # cursive (14)
- # data-science (1)
- # datomic (3)
- # figwheel-main (9)
- # fulcro (46)
- # jobs (4)
- # off-topic (8)
- # quil (6)
- # re-frame (5)
- # shadow-cljs (70)
- # spacemacs (3)
- # speculative (2)
- # tools-deps (2)
nothing has disappeared, it’s just some of the template stuff you might see doesn’t match up.
@tony.kay Good evening 🙂 I was reading through the routing section of the book / examples today and I don’t quite understand how idents for screens should be picked. The first part of the ident is the page (which afaik is so that we can do a union query on it), but the second part of the ident seems arbitrary. What is its role?
you’re right the first part is the page, because of union queries, and the second part is arbitrary
the can second part can be a constant when you’re looking at a fixed screen like
or in the same router you can swap in an ident for a specific record
the first part has to be distinct per route, and the second can be whatever, including something the query engine can use to fulfill your query results (like an ident of some data you loaded from the server)
@currentoor thanks for the reply! so if the second part is a constant, then it doesn’t matter at all what it is, right? And here you gave me an example where the ident is a record; how would you represent a route to a screen with a query that has a few dynamic parameters depending on route parameters? Would that be a constant as well, and then you would pull the parameters when loading the data?
That would be great, thanks 🙂 And while I am at it, where do you put data loading for a route? I was thinking of inserting a call to
df/load in https://github.com/fulcro-legacy/fulcro-template/blob/develop/src/main/fulcro_template/ui/html5_routing.cljc#L94 (based on the match)
so i know it’s possible but i don’t bother putting the data needed for a load in a route
but i first navigate to list view, which loads a list of tax-ids and their names (aka titles)
I see; reading through your code now; it looks like it also has loading indicators, which is another thing I’ve been trying to figure out 🙂
@currentoor componentDidMount seems like a good place; it gives you access to props to parametarise the query as well
i find componentDidMount is fine for getting it working quickly, but probably better to do it from a route change event handler type thing
in this project i’m using state machines all over the place and so i call load in state machine event handlers (along with route changes and whatnot)
@currentoor https://gist.github.com/hmaurer/9ed3992266288382435f88095d743257#file-mixed-router-cljs-L102 ; when I tried to implement loading indicator I had a flickering issue where the indicator would initially not render.
@currentoor did you encounter a flickering issue at first when you tried to implement these?
@currentoor well I think what was going on is that my UI was rendering before I triggered
df/load, and so that that point there was no loading marker
@currentoor Alright, thanks, will try that. Last question: when you do a
df/load for tax details, do you set the
> but probably better to do it from a route change event handler type thing isn’t that what I was suggesting initially? Putting it in the pushy callback? or am I misunderstanding it?
@hmaurer another downside to
componentDidMount is if you’re load is broken then it can cause your component to re-mount, which triggers yet another broken load and goes on in an infinite loop
if you do your loads in an event handler (state machine, onClick, client mutation, etc) then you can be sure it only happens that one time
are there any similar hooks to
afterRender built into Fulcro? I’m trying to use this, https://github.com/PEZ/clerk#after-render