3 ms·
How do you manage page-wide data consistency in Rails without a page refresh?
by robertoandred 4y ago
How do you manage page-wide data consistency in Rails without a page refresh?
- whatshisface 4y agoYou make sure you're only trying to do frameworkless development on pages where "data consistency" means "the text box displays the text that's in the text box." :-)
- theappsecguy 4y agoThere’s multiple approaches. Since everything is server side rendered, you can for example, stream updates through web sockets
- robertoandred 4y agoSounds like a lot of latency, waiting for the backend to render a template and send it over the wire every time the user presses a button.
- theappsecguy 4y agoYou don’t re render a template. Only what you need to. If it’s a single div then so be it. Which is why it’s SPA-like experience with server side code
- robertoandred 4y agoAnd where does that new div come from? It's not a backend template?
- theappsecguy 4y agoIn my understanding template would be the entire page. So while an an individual div re-rendering is also technically a template, it's not really the same thing. It's a tiny re-render compared to a page refresh. Again, this is a different spin on doing things. Rails preaches abandoning the over-complexity of the client-side in the browser and pushing work to the server. I personally love it. I'm sure someone who is as fast in React as I am in Rails is laughing reading this.
- robertoandred 4y agoYou're going back in forth about whether the html re-render that's sent back over the wire is always the entire page or only the specific element needed.
- jasonm89 4y agoHotwire