3 ms·
I wouldn't assume a fragment is any bigger than the raw data when it's compressed. { "things": [ { "id": 183, "name": "The Thing", "some date
by robertlagrant 4y ago
I wouldn't assume a fragment is any bigger than the raw data when it's compressed.
{ "things": [
{ "id": 183,
"name": "The Thing",
"some date": "2016-01-01",
},
{ "id": 184,
"name": "The Other Thing",
"some date": "2021-04-19",
},
]}
Vs
<tbody>
<tr><td>183</td><td>The thing</td><td>2016-01-01</td></tr>
<tr><td>184</td><td>The other thing</td><td>2021-04-19</td></tr>
</tbody>
They seem extremely similar to me.
- graftak 4y agoThe issue with this model is that many state updates are not scoped to a single fragment. When you go to a another page, you’ll likely want to update the amount of results on one or more detached components. That’s way more natural to by getting the length of an array of data structures than on a html fragment.
- robertlagrant 4y agoPossibly, yes, although many SPA sites seem to hit for updates every (visual) page change anyway, to get the latest results. It's rare that a UI will hold all the records to count locally, unless it's a small and slow-changing data set, so it's asking for a count whether or not it's getting it wrapped in HTML or JSON.