<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hlulani Baloyi</title>
    <description>The latest articles on DEV Community by Hlulani Baloyi (@hlulani_b).</description>
    <link>https://dev.to/hlulani_b</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4171821%2F5367ebef-a634-45a9-bad1-f0b7ef2336a6.png</url>
      <title>DEV Community: Hlulani Baloyi</title>
      <link>https://dev.to/hlulani_b</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hlulani_b"/>
    <language>en</language>
    <item>
      <title>Showing a league table offline when the signal at the ground is bad</title>
      <dc:creator>Hlulani Baloyi</dc:creator>
      <pubDate>Thu, 08 Oct 2026 19:38:07 +0000</pubDate>
      <link>https://dev.to/hlulani_b/showing-a-league-table-offline-when-the-signal-at-the-ground-is-bad-3c5c</link>
      <guid>https://dev.to/hlulani_b/showing-a-league-table-offline-when-the-signal-at-the-ground-is-bad-3c5c</guid>
      <description>&lt;p&gt;Our club plays at a ground where the mobile signal drops to nothing about ten minutes before kick-off, which is exactly when people want to check the log and the next fixture. So the small page I keep for the club had to work without a connection, at least for the last thing it managed to load.&lt;/p&gt;

&lt;p&gt;The table comes in as JSON: sixteen teams, eight numbers each. The first version fetched it on every page load and showed a spinner forever when the request failed. Not great on a match day.&lt;/p&gt;

&lt;p&gt;What I ended up with is boring but it works:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Fetch the JSON with a short timeout (four seconds).&lt;/li&gt;
&lt;li&gt;If it arrives, render it and save the raw string to localStorage together with the time it was fetched.&lt;/li&gt;
&lt;li&gt;If the request fails or times out, read the saved copy, render it, and show a small line under the table: "Last updated 14:05, no connection".&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The timestamp turned out to matter more than I expected. Without it people assumed the table was live and argued about points that were already out of date.&lt;/p&gt;

&lt;p&gt;Two things I'd do differently from the start. First, store the parsed numbers, not the HTML, because I changed the table layout twice and old cached HTML looked broken. Second, keep the cache key versioned (table-v2), so a format change doesn't try to read the old shape.&lt;/p&gt;

&lt;p&gt;Next I want the fixtures list to work the same way, with the next match pinned to the top. If you've done offline caching for something similar and found a cleaner pattern than localStorage plus a timestamp, I'd like to hear it.&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
  </channel>
</rss>
