Fork me on GitHub
#fulcro
<
2023-12-12
>
daemianmack18:12:50

any pointers to a recent, well-regarded example of paginating a fulcro app with synchronized URL history? i’m having a bit of trouble navigating the intersection of options like UISM and RAD and am not sure what modern state-of-the-art or even best practice is

tony.kay18:12:23

RAD is a library add-on for Fulcro. It simply adds some macros and creature comforts for putting together things with less code. Sync URL history is not really a primary Fulcro concern, and the only bit of code that does that is in the RAD add-on (HTML5 history support). Remember that Fulcro is meant to work in places other than browsers, so HTML-specific ties will not be in the core library (other than React-isms, including convenience wrappers for DOM factories). Look at the fulro-rad-demo. The defreport macro supports pagination in various ways, but then “server” pagination requires some tweaks (there’s extra work that you have to do, esp on the back-end, to even make that possible).

daemianmack18:12:42

thanks, i’ll check that out. i’ve largely gotten pagination working as expected, minus URL behavior — it’s just not clear which pieces are best used together in general.

tony.kay18:12:27

URL behavior is just something you have to hook into your own UI routing. You can either use low-level js against the History API, or use some additional cljs lib to detect URL changes. Then you map between the URL and routes in your app. dynamic routers use arrays as paths so that you can easily translate between the two. Of course there is also startup code: Is the user logged in? (Fulcro cannot know that). Is the URL allowed? etc. etc. So, the RAD history support takes a stab at some of that, but the startup logic still has to be something you write.

daemianmack13:12:04

architectural considerations aside, are there any good, recent examples of fulcro apps layering URL-observant pagination mechanics atop fulcro proper?

tony.kay16:12:50

fulcro-rad-demo has the url bits. RAD has some pagination support that is demoable there as well.

daemianmack18:12:51

thanks, i’ll dig in