fulcro

Book: http://book.fulcrologic.com, Community Resources: https://fulcro-community.github.io/, RAD book at http://book.fulcrologic.com/RAD.html
stuartrexking 2020-12-22T02:39:01.226100Z

Thanks all.

tony.kay 2020-12-22T02:39:10.226400Z

the multi-root stuff relys not on OO stuff, but react hooks. Not sure what you mean by OO react stuff. The hooks stuff is all functional. But yes, they are being used to create an on-mount and on-unmount lifecycle. That is not really in the purview of Fulcro itself, but something you should probably implement in your rendering layer…notifications when something is on-screen, and when it leaves the screen. You could also tie those events to mutations, which puts you in the Fulcro txn system. A diagram of the default (pluggable) tx system is https://github.com/fulcrologic/fulcro/blob/develop/src/main/com/fulcrologic/fulcro/algorithms/tx-processing-readme.adoc

tony.kay 2020-12-22T02:39:58.227100Z

most of tx processing is around full-stack integration…there’s really not much to it for pure UI: put the tx in queue, run optimistic things.

tony.kay 2020-12-22T02:40:09.227400Z

There’s no mess of other event based stuff

tony.kay 2020-12-22T02:41:23.228400Z

so, really simple: (transact EQL) -> submission queue tx node -> activation (runs all optimistic actions, queue sends) -> render

tony.kay 2020-12-22T02:41:58.229100Z

see docs on React hooks. You might be able to implement something like that, which would make it more approachable for “standard” fulcro users.

phronmophobic 2020-12-22T02:46:50.231800Z

does transact! run synchronously when you call it. if I had a pre draw step that ran some transactions, could that be an option?

genekim 2020-12-22T07:38:50.237800Z

Holy smokes. Again, thanks to lots of DMs with @holyjak and about 5 hours of hacking away, I finally got my first multiple cardinality join working (which now, looking back, was primarily because I misunderstood the EQL syntax…) But 15 minutes later, thanks to fo/query-inclusion, I got my form working to display tags for conference sessions. That’s pretty incredible. I’m starting to see the magic that Fulcro RAD enables! Kudos, @tony.kay! (Posting screenshot to share feelings of triumph…. mid-afternoon, I was seriously thinking, “how can I spend 25+ hours on this, and not even able able to do a join? maybe Ruby on Rails or perhaps even learning PHP might be a smarter choice…“) Onwards! 🙂

1🚀
Adrian Smith 2020-12-22T10:45:20.240900Z

I think this could have some interesting repercussions for Fulcro: https://www.youtube.com/watch?v=TQQPAU21ZUw

Helins 2020-12-22T16:40:51.247Z

Is there a way to force a root render on transact! ? I see that :`only-refresh` from different transactions are merged for the same transaction cycle (eg. 2 on-click event handler triggering roughly at the same time). So if one does not supply it expecting a full re-render while another does supply :only-refresh, things get messy

tony.kay 2020-12-22T16:52:30.248600Z

I suspect you’re over-using only-refresh. Do you really have a measured (production build) performance problem? Or are you prematurely optimizing in dev mode?

Helins 2020-12-22T17:31:43.252400Z

This is pretty much my first attempt trying to solve long delays on some click events. And it does solve them. But as such, it screws with any other handlers triggered at the same time, which is not uncommon given the hierarchical nature of the DOM.

Helins 2020-12-22T17:35:01.254800Z

I was hoping for a :force-root? option somewhere. Well, to be more precise I was first expecting that this problem would not exist, it's only after watching on the runtime atom that I noticed the merging (and after reading the source a bit, I understand why)

Helins 2020-12-22T17:40:20.256100Z

It seems I can either not use only-refresh at all, or have to use it everywhere (talk about over-using then 😛 )

Helins 2020-12-23T12:26:36.290800Z

Good point indeed, although I often simply disable Inspect when working on this app (because of a few reasons) so this particular point does not apply here. But the rest does, you're quite right that good measuring is important

2020-12-25T05:04:44.325600Z

@adam678 even if you disable inspect it can still show up iirc. I remember not preloading inspect, and removing it from devtools. Dev version was doing really big diffs after each transaction. But prod version was nice and smooth.

Helins 2020-12-25T09:21:50.325900Z

@bbss Really?! I disable it by setting inspect-client/INSPECT to "disable". It seem to work as the inspect extension does not detect an app anymore and I believe there is no watch on the state atom. Could it be doing something else in the shadows?

2020-12-25T09:22:22.326600Z

Hmm, it might have changed or you’re hitting a different issue!

2020-12-25T09:23:01.327600Z

Sounds like you’re safe then, have you used the profiler to see what is taking the longest?

Jakub Holý 2020-12-22T18:05:43.256500Z

you can supply your own transaction processing (e.g. wrapping the default one) and do what you want/need there, such as adding support for :force-root?

Jakub Holý 2020-12-22T18:07:43.258100Z

v2 of https://blog.jakubholy.net/2020/troubleshooting-fulcro/ published, with focus on troubleshooting the backend, i.e EQL resolution in Pathom. Diff: https://github.com/holyjak/blog.jakubholy.net/commit/307850120a4253b1ec8e96a644204ee4bc9ea840#diff-872e80ad034756ce7edc137851745c47a67a8aa43b2c25857408166f8a161ce4 Also added this section, and I am curious what you think about it: > Fulcro is fundamentally simple and so is, in essence, troubleshooting it. It consist of a number of small, simple parts connected together. All problems stem either from not using a part correctly or not connecting them correctly together (the price of Fulcro being more library-ish then framework-ish). The key to troubleshooting is then to find the relevant part and zoom in on it and then to check all the relevant connections up to the UI. And you need to know how to optimally troubleshoot these various parts. > An early distinction to make is whether it is a frontend problem (mostly a matter of the correct query/ident/initial state/composition into parent) or a backend problem (mostly a matter of resolvers and their registration with Pathom or the underlying data sources). > For example. if the UI is not displaying the expected property, you might find out that it is because the server does not return it (connection). You zoom in to the resolver responsible for it (the simplest part) and the DB query it calls (even simpler sub-part) - is the query working? Is the resolver working? Is the resolver registered with Pathom? Is the query actually correct? The wrong solution is to stay at the level of the UI and work with the full stack while trying to locate the root cause of the problem. > Stuart Halloway’s https://youtu.be/FihU5JxmnBg: offers a great approach to such a troubleshooting. > It is crucial that you know your tools so that you can really focus on the relevant part of the sytem and to explore / invalidate a particular hypothesis about it and the cause. Primarily this means that you need to have Fulcro Inspect working and be familiar with its many powers.

3👏4🙏
tony.kay 2020-12-22T18:10:21.258300Z

you do not need to go that far…I guarantee you’re running into something that has a better sol;n

tony.kay 2020-12-22T18:13:13.258500Z

I’ve never personally needed :only-refresh

tony.kay 2020-12-22T18:13:26.258700Z

and very very rarely a forced root render

Helins 2020-12-22T18:17:20.258900Z

Really? it's advertised as such an improvement over KR1. (by forced I meant ignoring only-refresh, not disabling sCU)

Helins 2020-12-22T18:18:53.259100Z

The app I am working on currently is already doing too much (generating MIDI events, animating a full screen canvas, cannot get help from a webworker, and quite a lot of DOM stuff...), so things can get a bit out of control if I am too careless about the DOM

Helins 2020-12-22T18:22:39.259400Z

@holyjak Indeed, it looks like I can pretty much copy/paste the default one and simply make it ignore any :only-refresh once it encounters a trx which doesn't have one

tony.kay 2020-12-22T19:06:41.259600Z

Right, the overall system is designed to be fixable in any of those ways (use the optimizations I’ve given, or tweak them to your app). However, I would start by trying to measure things. I’d also try the syncrhonous txn processing. You might find that you’re over-rendering, and should split some components up in order to get SCU improvements, etc.

tony.kay 2020-12-22T19:07:42.259800Z

so while I don’t know your code, my experience is that with some good measuring (use CPU performance tab of Chrome to start) you may be misunderstanding the performance

tony.kay 2020-12-22T19:08:06.260Z

Inspect has a lot of overhead at times in dev, for example. You might be seeing something that doesn’t even show up in an advanced prod build

tony.kay 2020-12-22T19:08:11.260200Z

as does Guardrails

tony.kay 2020-12-22T19:08:22.260400Z

and debug loggin

tony.kay 2020-12-22T19:08:23.260600Z

etc

wilkerlucio 2020-12-22T20:08:02.260900Z

figured out, was missing adding the attributes in the attribute list at the end of file :man-facepalming:

Jakub Holý 2020-12-22T20:49:25.261400Z

Good point. My Fulcro app is sometimes also slow in dev but OK in prod.

Jakub Holý 2020-12-22T21:57:21.262200Z

I have created the long overdue https://github.com/holyjak/awesome-fulcro/ Please send your PRs with more resources!

7🔥
Jakub Holý 2020-12-23T18:05:44.293800Z

@souenzzo I've added it now

souenzzo 2020-12-22T23:12:27.263600Z

I started a https://github.com/souenzzo/eql-style-guide