Hello elm coders,
I’ve been digging my teeth into the Angular framework lately and would like to explore the Elm way of doing things for the next few days.
The functionality I’d like to reproduce can be seen here, in this stackblitz.
This demo represents the main features I’m looking for in a front end technology:
- when hitting the root route, you are redirected to
- visiting the page simulates triggering a long and expensive HTTP call without blocking the UI
- when filling the form inputs, their values are reflected in the URL
- this allows one to share links and recover the form state from the URL later
- when clicking on “GO TO LIST” you go to another page
- the previous form page stays in memory for later restoration
- when clicking on “GO TO FORM”:
- the form state is optionally restored if “Keep form data” was checked
- the expensive HTTP is not triggered anymore since we already have the data
- the whole page is cached, not the HTTP call.
The reason I want to cache the whole page is that restoring the UI from cached HTTP calls does not make for a good user experience IMO (at least in Angular). The problem being that there is a noticeable lag and jitter (maybe between 10 ms to 50ms) when rebuilding a complex page. Instead, I prefer to cache the whole page for instant feedback upon revisiting a page, while at the same time refreshing the data from new HTTP calls. That way, the user interface feels very snappy and almost desktop app like.
In Angular, I can obtain this behavior by making use of a tricky technique: implementing a custom “route reuse strategy”. With this technique, a previously built page object can be restored from a global cache. But using such a technique can open one up to all sort of bugs and hard to manage life cycle state (that can lead to unintended memory leaks, etc.).
So that’s why I’d like to explore Elm again. I went through 75% of the guide a few months ago and I’m looking for practical advice and what to learn to be able to achieve this demo. And maybe if I should use any libraries such as this one: elm-router 2.0.0
Thanks for any feedback