A Slow Service and an Empty List Are Different Results

A web application needs a way to represent valid empty data separately from data it could not retrieve within the available time.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace two requests
  2. Keep the next action specific
  3. Preserve two outcomes a reader can act on differently
  4. Test loading, successful absence and failure separately

Trace two requests

A completed search with no matches can show an empty list. A storage timeout may leave the actual matches unknown. Unknown outcomes provide the related distinction for remote operations.

Keep the next action specific

Offer correction for a restrictive filter and a deliberate retry for a temporary failure when appropriate. A structured result can carry the explanation without relying on the list length.[1][2]

Preserve two outcomes a reader can act on differently

A report list can query successfully and find no matching rows. A slow upstream service can exceed its deadline before returning a result. Showing both as “no reports” implies a successful observation when none occurred. See connection and response timeouts.

Completed lookup returns [] → show known empty result
Deadline expires → present temporarily unavailable result
Previously cached content can be labeled with its freshness if shown

Test loading, successful absence and failure separately

Use fixtures to hold the request open, return an empty result and fail it. Confirm each produces its own expected state. A retry can be an appropriate action when the dependency is temporarily unavailable.

References

  1. IETF, RFC 9110: HTTP Semantics ↩
  2. WHATWG, HTML Living Standard: Forms ↩