Fork me on GitHub
Jakub Holý (HolyJak)08:01:51

@tony.kay I am trying to learn Fulcro and in the process discovering improvements to the docs that I'd appreciate so you are going to hear from me a little 🙂 Great work with the Fulcro ecosystem and documentation! I have some comments, typos, etc regarding the book - what is the best way to send those? Paste here or ...?


Usually the less work Tony has to do with it, the better 🙂 so providing a mergable PR for this document would be best IMO:

👍 4
Jakub Holý (HolyJak)09:01:16

Thanks! Somehow I couldn't find a link from the book to its GH repo...


You are welcome! Yeah, adding a link to the source document in the intro would be a nice addition :))


What they said is correct. If you have anything significant beyond typo fixes or links then it might make sense to ask questions about them first…otherwise, PR away 🙂

👍 4

@tony.kay CSRF for web + cookies for native latest Inspect Electron won’t work nicely with native which could be easily fixed with a bit of inspect-ws customization i’d make another PR with inspect for native fix if those are merged


Fulcro 3.1.8 deployed with inspect ws fix


If you want to update your PR to use the new 3.1.8 inspect-ws preload, then it should be all set I would thing @UDQ2UEPMY


@tony.kay great, thanks! updated PR with inspect fix + readme about it


merged, thx


Hallo! There is a reference to binding *app* when performing SSR here: but I can’t find anything on what exactly this should look like in the server. Is one expected to make any data structure from scratch that conforms to the ::app spec?

parrot 4

the application ns is cljc…it is just an app.

👍 4

I've got component like:


(defsc TerminalBadge [_this {:terminal/keys [connector pin]}]
  {:query         [:terminal/id :terminal/connector :terminal/pin]
   :ident         :terminal/id}


hmm, just one second... 🙂


OK, nevermind 🙂

😄 4

(defsc AddConnectorModal [_this {:add-connector-modal/keys [show]}]
  {:query [:add-connector-modal/id :add-connector-modal/show]
   :ident (fn [] [:add-connector-modal/id :singleton])
   :initial-state {:add-connector-modal/show true}}
  (js/console.log "Show is" show)


Why does show is null?


in order for show to not be null, the parents all the way to root would need to load its initial-state in their initial-state … so the parent would need to have something like:

(defsc Parent [this props]
{:query [{:c-modal (comp/get-query AddConnectorModal)}] 
:initial-state {:c-modal {}}})
and the parent of Parent would need to have it in its initial-state, etc OR In a mutation you can handle saving that into state your self by calling (comp/get-initial-state AddConnectorModal) and saving that into state where it should go … In other words, :initial-state is just a convenience for composing initial state in at app startup … but I find it’s tricky when dealing with lists of things, where that initial state isn’t really there on app start, and I need to take a more intentional approach to getting it into app-state.


Do I have to propagate this initial state back to the root?


Sorry for this flood of questions - I've got hard time wrapping my head around Fulcro 😞


I am trying to refactor my sample app a bit, but I've got problems with general approach how to organize properties, pass them, etc.. I don't even know truly how to ask question and why it is not working, but if somebody will have a chance to look why my connectors returns null :


I must be doing something terribly wrong, I see I've got problems following the logic properly.


I wanted to separate everything from connectors tab into ConnectorsTab component, but resolve only top level :connectors with resolver (as other state is UI-local)


Just one note, is actually true not null, as indicated by comment (there's true on screenshot).


If somebody could have a look at this code to point out any general errors in approach, etc, I'd be very grateful.. But I am completely aware that's a lot of somebody's time I am asking for. 🙂


And line 58 should instead be:

(ui-add-connector-modal {:add-connector-modal/show add-modal-visible?}))))


In fact that change to 58 should get the component visible, but it would be disconnected from state because there’d be nothing where its ident is pointing unless you add it to its parent’s query and initial-state. But as of right now, there’s no need for that component to have an ident, so it could just run from props that get passed to its factory … I would say it only needs an ident if it should have state that persists between different uses of it at different times. But because it is a transitory component (as of now) it doesn’t need an ident and can just exist almost as a functional component … and it could be a purely functional component, but using defsc make sure it only gets re-rendered when its props change.


As for :connectors in ConnectorsTab being null, it looks like you have a list of edges in the root of app state, so it appears that when you do the load, you need to add a :target [:connectors-tab :singleton :connectors] to the load!


in other words, somehow you’re loading your list of connectors into root instead of in the component that needs it


Thank for your replies!


Let me explain: I wanted to use connectors instead of connectors-tab/connectors in beucase I expected multiple components to use one, already loaded root level :connectors list.


And I didn't wanted to load them separately to every component with :target


Because here I have this ConnectorsList in ConnectorsTab, but I expect it have things like ConnectorSelctor which will rely on the same data.


So I think I'd rather avoid asking server multiple times for the same data.


To re-state my question: how can I feed multiple components with on top level :connectors list?


I can load to multiple targets, but any modification of the state is no longer local.. Like, "add connector" component will need to know each component to which it should add a connector.


Oh I think I see. Have you tried something like: :query [[:connectors '_]]


That’s a link to something at root from any component


Where can I find anything about that syntax in documentation?


Oh, I see, link queries