▲ | 8n4vidtmkvmk 3 days ago | |||||||||||||||||||||||||
For first load, yes. The idea is that you never have to send the template again after that. Cascading is a separate problem. You can bundle all the data into a single request if you want. You can even send JSON along with the HTML in the first request. | ||||||||||||||||||||||||||
▲ | hasanhaja 3 days ago | parent | next [-] | |||||||||||||||||||||||||
Why does this have to be the baseline architecture when you can render the HTML on the server with the template and data? Why send the data and the JavaScript to parse that data and transform it into HTML in a users browser when you can do it on the server? For requests after the first, you can still continue to send the rendered HTML to be placed into the document. Here's an example using HTMX: https://htmx.org/examples/lazy-load/ | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
▲ | wild_egg 3 days ago | parent | prev [-] | |||||||||||||||||||||||||
> The idea is that you never have to send the template again after that. This implies or assumes that sending the template again is a problem. In practice, it's not. HTML compresses well and the difference between the compressed JSON and HTML response is often on the order of hundreds of bytes. That assumes equivalent data content which, as I've said above, is often not the case. JSON payloads tend to be larger and we need more of them to render the same UI. |