Fork me on GitHub

Is there a way to hint the inspector to not monitor a transaction? Sometimes when the transaction is too big or many transactions happen in short amount of time, the browser gets really slow because all the data need to be serialized to the inspector (if I understood it correctly)

Jakub Holý (HolyJak)14:03:33

Look at the inspector client ns in Fulcro, make a copy & adjust, use it instead


Hi there, I'm working on some simple Fulcro app at the moment and have stumbled across a simple yet alluding problem. I want to have a simple token-based authentication system for my app, and the flow is really basic: 1. User enters creds and press Login 2. Server authenticates against the creds and return back a JWT token 3. The frontend saves the token to be used in subsequent requests At the moment I'm looking at client request middleware to augment outgoing requests with a Authorization header, but the problem is that this means the very first request (the login request) will also be augmented, which is not what I want. What is the recommended/common way of handling this situation? I'm thinking about simply checking if my token is not nil and augment the requests accordingly but I'm not sure if this is the right way to do it. Thanks in advance.


You can reset the remote after login, or use more than one remote.


@U0CKQ19AQ Thanks a lot 🙂 I'm actually thinking about doing something similar to the latter where I'd have 2 remotes, one for any unauthenticated requests and one for authenticated ones. The former sounds like I'd need to modify the remote logic for all mutations.


You don’t have to modify anything. That is all built in already.


You just have to add one or more remote, and include the correct one in a mutation…See


I.e. in the application definition, add a remote with a made-up name like :public , then in the mutation use a (public [env] true) section to indicate that that mutation uses that remote. Done.


Ah that's awesome! Will give it a try. Thank you so much 😄

Timofey Sitnikov12:03:23

Is it OK for multiple stateful components to have the same :ident? For example, I have a list of people with each line item as Person, than I have a dedicated page for a Person that I call PersonPage with extra information*. Both *Person and PersonPage seem to require the same :ident.

(defsc Person[_ {:person/keys [id name]}]
  {:ident :person/id         ; <<<==== SAME AS PersonPage
   :query [:person/id :person/name]}  ;
  (dom/p (str "Person ID: " id " -> ") (dom/strong name)))

(def ui-person (comp/factory Person {:keyfn :person/id}))

(defsc AllPeople [_ {:keys [all-people]}]
  {:ident (fn [] [:component/id ::AllPeople])
   :query [{:all-people (comp/get-query Person)}]
   :initial-state {}                        
   :route-segment ["all"]}              
    (dom/h3 "All People")
    (dom/ul (map ui-person all-people))))

(defsc PersonPage [_ {:person/keys [id name biography]}]
  {:ident :person/id        ; <<<==== SAME AS Person
   :query [:person/id :person/name :person/biography] 
   :initial-state {}                        
   :route-segment ["person" :person-id]  
   :will-enter (fn [_app route-params]            
                    (js/parseInt (:person-id route-params))]))}
  (dom/div {} (dom/h1 "Single Person Page")
           (dom/p (str "Person #" id ": ") (dom/strong name) " - " biography)))

Thomas Moerman19:03:57

Perfectly normal and idiomatic, both query from the same normalized person "table" in the Fulcro db.

Timofey Sitnikov11:03:30

Thank you for confirming, this is big help ...