fulcro

Book: http://book.fulcrologic.com, Community Resources: https://fulcro-community.github.io/, RAD book at http://book.fulcrologic.com/RAD.html
2021-03-20T01:03:50.075700Z

Hey Luis, yep you generally should trigger mutations when an event occurs (user event like click or touch event, or some timer firing, or a router change state)

tony.kay 2021-03-20T01:25:30.075900Z

BUT, a production app won’t have Inspect turned on, so it cannot detect those. You’d only be able to detect apps that were released in “development” mode, which is much slower, and therefore unlikely. Inspect adds quite a bit of overhead to the app (it has to encode states, remember history, etc.)

👍 1
tony.kay 2021-03-20T01:29:48.076100Z

If you take a look at the internals of RAD defsc-form and defsc-report (the UI state machine, in particular), I’d consider those good examples of how you handle quite a few concerns like that. But as @alex-eberts said: don’t try to run too fast. If you don’t understand the core basics, those internals will probably be a bit much.

zhuxun2 2021-03-20T07:00:01.081Z

Is there going to be performance problems if I don't shrink wrap every query? For example, the Login panel needs two field stored by the ident [:component/id :session], but is it okay if I write

{:query [... {[:component/id :session] (comp/get-query SessionQuery)}]}
where the SessionQuery is the huge all-encompassing query that I use for something else on the screen, but does have the two fields that Login needs?

zhuxun2 2021-03-20T07:05:53.085Z

A lot of the time, I have a large deep query lying around for a large widget. And I am tempted to use it in quite a few smaller widgets that only uses a tiny sub-tree of this huge query, I wonder if it is okay (or even intended)? I feel like it's very non-ergonomic having to write every slim shrink-wrapped tree for even the smallest widget.

zhuxun2 2021-03-20T07:22:27.086400Z

Unrelated: seems that uism/trigger-remote-mutation does not support :without in df/load! (or the underlying df/elide-query-nodes), right? Doesn't this make it impossible to do incremental load with uism?

Jakub Holý 2021-03-20T10:59:25.088200Z

Doesn't sound maintainable to me as you are coupling 2 unrelated components.. What if Login starts needing a field not requested by Session? Each component should query for (only) the data it needs. If the data is shared, put them to a well-know place in the DB (eg. :ui/current-session, the value can be the data or an ident pointing to the data) and use Link Query to access it from all places that need it.

Jakub Holý 2021-03-20T11:01:28.088600Z

Though your singleton component you have could also work just fine...

Jakub Holý 2021-03-20T11:03:27.088800Z

Login queries for whatever props it needs, its parent has the Link/Ident query to connect to the session data.

Jakub Holý 2021-03-20T11:04:33.089Z

I have https://blog.jakubholy.net/2020/fulcro-divergent-ui-data/ but perhaps not so helpful here...

👍 1