News for hackers. Stuff that matters.
Re:A Real World React – Htmx Port by robertlagrant on Sunday October 16, 2022 @12:14PM (#33224744)
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.
Re:A Real World React – Htmx Port by graftak on Tuesday October 18, 2022 @01:34AM (#33243335)
The 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.
Re:A Real World React – Htmx Port by robertlagrant on Tuesday October 18, 2022 @05:09AM (#33244743)
Possibly, 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.