The homepage of kanto-tactics.com says: "Loading the latest ranked data from the game's feed..."
But what happens if the game's feed is down? Or rate-limited? Or returning corrupted JSON? A tool site relies on external data, but it cannot break when that data is unavailable.
The Stale-While-Revalidate Pattern
When the app initializes, it shouldn't block rendering waiting for the network. Instead, it should read the last successful feed data from localStorage or IndexedDB . The UI renders instantly with the cached data, showing a subtle "Refreshing..." indicator. Behind the scenes, it fetches the new data, calculates the new rankings, and seamlessly swaps the DOM.
Surfacing Data Freshness
One of the best design choices on the site is printing the "rebuild date" and "rules version" right above the table.
If a fetch fails, the app doesn't show a fatal error screen. It falls back to the cache and explicitly tells the user: "Showing data from yesterday.…