Keep the Last Data: A Design Rule
lesson product
- Built with
- PHP
- MariaDB
Some pages on อปท.com get their content from a scheduled feed: weather, news, warnings. A feed can be late. The design rule I follow is short: keep the last good data, and tell the reader when it was updated. I never hide the section.
The rule
When a refresh does not bring new data, the page keeps the latest value that worked. It does not drop the section, and it does not show an empty box. It adds a small note with the time of the last update and a calm line that the next refresh is on its way.
Here is the rule as pseudocode:
for each source:
fresh = fetch(source)
if fresh is ok: save(fresh, now)
show(last saved value)
if saved value is older than the refresh time:
add note "Last updated <time>. Next refresh is in progress."
Why a section should stay
A reader opens a page for an answer. A last known forecast with its date is still useful. An empty section tells them nothing, and it makes the whole page look unfinished.
The second reason is trust. The reader can see what the data is and how old it is, and then decide for themselves. Honest labels matter here. A forecast for a weekend that has passed is labelled with its real dates, not with "this weekend".
The wording
I keep the note positive and plain. It says when the data was last updated and which part is waiting for its next refresh. It does not say "failed" or "error". The facts are the same, and the reader stays calm and informed.
Each source keeps its own timestamp. One late feed then marks only its own card, and the other cards on the page stay as they were. The old value is only replaced when a new good one arrives.
The same rule at the directory level
The directory of local offices follows this rule everywhere. I wrote about the directory in why I built a directory of 7,800+ local offices: the data is public and refreshed on a schedule, and the page keeps the last data and says when it was updated. You can read the project on the case study page and see its stack on the demo page.
Try it
The toy below uses sample data only. Nothing is fetched and no real office is involved. Turn the sample feed off and watch what the page does. Compare the "hide it" view with the "keep it" view.
Interactive · toy
When a feed is late, the page keeps the last good data and says when it was updated. It never hides the section.
- Feed on: the newest sample data shows, with its update time.
- Feed off, hide-it view: an empty section with nothing to read.
- Feed off, keep-it view: the last data stays, with 'Last updated <time>. Next refresh is in progress.'
- Each source keeps its own timestamp, so one late feed marks only its own card.
More small toys like this live in the widgets portal, and the other writing is on the notes page.
What you can take from it
If your site shows data from a feed, decide the late-feed behaviour before you build the card. Store a timestamp per source. Reuse the last good value. Write the note in positive words. Then the page stays whole on every day, not only on the good ones.
If you have a data feed and want a page that stays readable when it is late, tell me what you have. I reply with a one-page recommendation first.
Book the free consult