Fork me on GitHub
#fulcro
<
2022-03-16
>
tony.kay02:03:36

I’ve added a new pre-built report state machine for RAD in com.fulcrologic.rad.state-machines.incrementally-loaded-report. RAD version 1.1.7-1. As the name suggests this machine requires a special resolver that can return the report in segments (limit/offset). It will then load the report rows in chunks to prevent timeouts, and will allow you to render progress (custom rendering) by grabbing the loaded count from raw-loaded-item-count. See the docstrings in that ns for more details. I don’t have time to document it right now, but thought local users of RAD in here should know it exists, if nothing more than as an example. A resolver that works with it will need to look for query parameters on the load of :report/offset and :report/limit, and return {:report/next-offset n :report/results […]} where n is the next offset to pass in (-1 means done).

❤️ 4
Pragyan Tripathi11:03:23

I was trying to implement it in my project. Glad to see it there. Saves me a lot of time. Thanks a lot.

tony.kay15:03:53

if you’re using Datomic, you’ll probably need a composite tuple to implement that efficiently, since index-pull can do offsets well, and a composite can group together the things you care about.

👍 1
tony.kay02:03:31

A more advanced version of this could be written that accepts filter/sort parameters so that you can support a complete server-side pagination, but that was not my immediate need. This one just loads things in chunks to prevent network timeouts and give better user feedback. All results are still pre-loaded then paginated/processed client-side.