brainlid

brainlid

Restore LiveView State on Startup

You are storing some Phoenix LiveView state in the browser. You want to retrieve that saved state as early as possible to improve the user experience.

The approach we used earlier waits for the LiveView to request the client to send the data. In your situation, you know you want the data, so why wait around to be asked for it? Can you have it automatically pushed from the client without being requested? Can you do it in a way that is reusable for other pages and other LiveViews and not just this one page?

This recipe improves the design and even makes it work for multiple LiveViews in the same application!

Where Next?

Popular Frontend topics Top

New
First poster: PaigePalmer
Progressive Web Apps (PWAs) are starting to get some attention. For instance, Amazon is using it for game streaming service on iOS. PWAs ...
New
First poster: bot
In JavaScript programs, asynchrony arises in situations such as web-based user-interfaces, communicating with servers through HTTP reques...
/js
New
First poster: bot
Decided to write this blog post because I couldn’t find any documentation or online examples like the one I’m sharing here. Every example...
New
First poster: bot
In this article, I will discuss my journey from being an anti-TypeScript developer to a developer who now couldn’t think of going back to...
New
First poster: bot
JavaScript has come a long way since I knew it as the “D” in DHTML. For anyone like me, who’s been reluctant to use the latest syntax tha...
/js
New
First poster: bot
User-preference based media features, container queries, and media queries for new screen types, such as foldable screens, will enable us...
New
AstonJ
I love videos like this and it follows the same theme as @jaeyson’s thread here - I reckon the @ElixirCasts crew should consider experime...
New
First poster: bot
CSS Fingerprinting is a technique of tracking and gathering information on site visitors. This method exploits the nature of CSS to track...
New
First poster: bot
Why in 2021 would you bother making a website without js? While researching this post I found two really great sources of information. S...
/js
New

Other popular topics Top

AstonJ
What chair do you have while working… and why? Is there a ‘best’ type of chair or working position for developers?
New
ohm
Which, if any, games do you play? On what platform? I just bought (and completed) Minecraft Dungeons for my Nintendo Switch. Other than ...
New
DevotionGeo
I know that -t flag is used along with -i flag for getting an interactive shell. But I cannot digest what the man page for docker run com...
New
dimitarvp
Small essay with thoughts on macOS vs. Linux: I know @Exadra37 is just waiting around the corner to scream at me “I TOLD YOU SO!!!” but I...
New
Exadra37
Oh just spent so much time on this to discover now that RancherOS is in end of life but Rancher is refusing to mark the Github repo as su...
New
AstonJ
We’ve talked about his book briefly here but it is quickly becoming obsolete - so he’s decided to create a series of 7 podcasts, the firs...
New
New
AstonJ
Was just curious to see if any were around, found this one: I got 51/100: Not sure if it was meant to buy I am sure at times the b...
New
PragmaticBookshelf
Author Spotlight Jamis Buck @jamis This month, we have the pleasure of spotlighting author Jamis Buck, who has written Mazes for Prog...
New
PragmaticBookshelf
Author Spotlight: Sophie DeBenedetto @SophieDeBenedetto The days of the traditional request-response web application are long gone, b...
New