Fork me on GitHub

How are long running mutations typically handled in Fulcro? I have an app where most of the page is graphs. I'd like to have them update as often as possible, but the page will lock up for ~0.3 seconds while re-calculating the data and re-rendering. Is it possible to pause a mutation halfway through (with still consistent data) and continue updating on the next ui keyframe?


i think you’re going to have to break your mutation up into smaller mutations


fulcro does use requestAnimationQueue to do it’s processing, but mutation actions are atomic


Right. I can do that, but can I chain them so that the first ends and it queues the next partial?


correct, you can transact additional steps inside mutations in fulcro 3


now if that is still too cumbersome, you can add some setTimeout delays


Oh, cool. I didn't know if it was possible or not. Not to cumbersome, I just couldn't figure out how to perform a transaction inside a mutation. Time to hunt it down.


mutation env gets app


you can call (comp/transact app [(…)]


in a mutation action


Oh, duh. Thank you! I was trying to find out why it is always (comp/transact this ...). I'm assuming that fulcro just follows the this component up to get the app to do the transaction on?


Perfect. That's a much simpler solution than I expected.


happy to help


Oh look, JS is finally catching up:

😆 4

the last commit by a human being appears to be from 2018 though


Oh my word that is a cumbersome API


Guys, I am new to Fulcro and I had a small question: I have a UI component which is "subscribed" on a particular key in the browser DB. When I run the mutation, I can see that the state of my browser DB changes to reflect the exact change I did in the mutation, but my component does not re-render. What could be the issue?


This could be an ident thing? I’ve hit that issue before =)… Try doing this as a quick test:

[com.fulcrologic.fulcro.rendering.keyframe-render2 :refer [render!]]

(defonce SPA (app/fulcro-app
               {:remotes {...}
                :optimized-render! render!})) ;; Pass it in here to change your renderer.
If that fixes it, then you can either leave it like that for now (I’ve done this), or work out how to update ident’s correctly =)…


Has there been a discussion about changing the default renderer? I imagine the reason it hasn’t been done is for backward compatibility. But for all new users , we should make it very clear that the first thing they should do is change to keyframe-render2 as @folcon said above. I know it’s in the docs, but in chapter 19 or something like that. Maybe a big old message at the top of the dev guide, template, etc. would help? I only bring it up because this is the second new user in 12 hours (and many, many more in the past) with problems related to using the default ident-optimized renderer, which is a more complicated and usually unnecessary optimization.


Maybe lengthen the blurb in the docs a bit. It wasn't too hard for me to find the relevent docs when I was running into the same issue. The primary issue there was that I was still hesitant to switch to keyframe-render2. I ended up needing some more info overlayed to change.


It took me a fair while to work out this was a problem :)... I don't even know what the performance penalty is :)...


IIRC, there are real trade offs between ident and original keyframe renderer, and which performs better would vary depending on your app. But keyframe2 in most cases outperforms them both, and is pretty much the best of both worlds.


That’s what I recall from the discussion when Tony originally released keyframe2, but I might be remembering wrong, and I haven’t done any formal benchmarks or have numbers to back it up, so grain of salt time. But I do think saying keyframe2 should be the starting point and optimize with ident renderer later if needed is a pretty uncontroversial statement. We just need to get the message out better.


I would think that updating the default template would help a lot, there’s an expectation of how do I get started? => I’ll just use the template


@mdhaney multiple roots renderer (based on keyframe2) is the default since Fulcro 3.2.2


@fjolne.yngling ah, that’s great! Should help a lot going forward.


yeah, with the hooks support there appeared a new cool way to manage transient components with real state, but that required multiple roots renderer to work


I didn’t quite understand that video, would you mind briefly expanding?


Thanks, I'll take a look at it :)...


Tony shared it some weeks ago but you know slack history...