Fork me on GitHub

I'm trying to implement a remote file tree viewer like this.


The key requirement is laziness. I want to make it so that the initial remote request only asks for one level. Further requests for listing files in the sub-folders will only be sent when the triangle is clicked.


I read through but still have questions. How would you design the stated component?


I'd imagine the initial request be something like this:

[:dir/id :dir/name
 {:dir/files [:file/id :file/name]}
 {:dir/sub-dirs [:dir/id :dir/name]}]


But how would you write the :onClick function for the triangle?


Another unrelated question: can I have a UI state :ui/xxx that is not shared between different views on the same entity? I don't want to use separate ids for them because I want the remote props be linked. This is very common requirement for e.g. implementing checkboxes on a tree view that have one node appearing at multiple locations.

Aleksander Rendtslev16:03:06

I would personally recommend using hooks for this. It's easy to reason about and it becomes very obvious that that is local state. And it works really well with Fulcro. Just set use-hooks? To true


You can always use component-local state if you want a component-local value that is not part of the actual state in the fulcr odb


on the laziness: your recursive query would just state 1 instead of , and then you’d pull the next level from the node that is expanded


How do I pass props to a component that I'm routing to?


read: :will-enter