As a reader, I want to refresh a page and be told plainly when it cannot be loaded, so that I always know whether I am looking at the latest content and can try again.
Situation
I am in the Read tab. A page is open and may have changed, or I have just opened one on a poor connection.
What I do
Pull down on a document to refresh it.
If a page fails to load, read the message and tap "Retry".
If it still fails, tap Back to return to the page before.
What I should see
Pulling down shows the refresh spinner at the top while the page I was reading stays in place, then the new content replaces it.
A refresh reloads the document, its lists and child documents, its authors and its discussion together.
A page that has not arrived yet shows a spinner in the middle. Its title reads "Document", or "Seed" on the home.
A page that cannot be loaded shows the reason and a "Retry" button, with "Check your connection, then try again." beneath.
The reason is specific: "Couldn't reach the server.", "The server answered 503.", "The server sent something unreadable.", "This document doesn't exist on this server.", "This link is not a Hypermedia document." or "This document has a redirect loop or too many redirects."
"Retry" always asks the server again. A failure is never remembered in place of a page.
A failed page never shows another document, such as my home, in its place.
Back works from a failed page and returns to the page I came from, intact.
A document that has moved opens at its new place, and its child list, discussion and shared link are those of the new place.
A request that gets no answer gives up after about 15 seconds and shows the failure.
The directory and an author's profile each show their own spinner, and their own reason with "Retry" when they fail.
When something goes wrong
I open a document with no signal and read "Couldn't reach the server." I move to where I have signal and tap "Retry": the message disappears and the document shows.
A refresh that fails replaces the page with the reason and "Retry".
Not included
Nothing can be read offline. Pages are kept only while the app is running (Read: loading pages, caches and embeds).
"Check your connection, then try again." appears under every failure, including a document that does not exist, where it does not help (Loading, failure and empty states).
The author profile and the directory sheet cannot be pulled to refresh.
I am not told that a document was moved. I simply see it at its new place.
Trace
Story US-READ-10, status Shipped. These links are kept in step with the traceability matrix and with the "User stories" section of every page listed here.
Design
Page | Part it plays |
|---|---|
Loading, failure with Retry and empty for every screen | |
The exact strings of the document, directory and author states | |
Pull to refresh and progress indicators | |
The States table: loading, failure, refreshing; failure never substitutes another document | |
The sheet's own loading and failure states | |
The profile's loading and failure states | |
The message and Retry button | |
The spinner labelled "Loading" | |
The refreshable list behind pull to refresh | |
Scrolling and the pull gesture | |
Every piece of data has a loading, a failure and an empty presentation | |
Failure never falls back to home | |
Back from a failed page | |
How errors are worded | |
The failure and loading strings |
Implementation
Page | Part it plays |
|---|---|
The readEpoch counter for pull to refresh and refresh <resource> for Retry | |
epochSeen: a new epoch drops that server's caches | |
Caches and generations, failures never cached, redirects, the failed page | |
The 15 second timeout and the three transport error messages | |
The not-loaded branch of DocScreen, the refresh and refreshing attributes | |
readRetry, readRefresh, readDirRetry, readAuthorRetry | |
Directory and author failures returned as pages with an error | |
discussEpoch + readEpoch: refreshing a document also refreshes its discussion | |
StatusLine | |
readEpoch and the resources it feeds | |
The redirect, not-found and document answers of /api/Resource | |
The list refresh and refreshing attributes and the progress element | |
fetch with exactTimeout on the device runtime | |
fail fetch and pass fetch; the failure and recovery tests | |
load.test.ts and client.test.ts | |
No offline reading |
Code
File | What |
|---|---|
The refreshable list and the not-loaded branch: StatusLine, the connection hint, the spinner | |
page, loaded and the title fallback "Seed" or "Document" | |
StatusLine with Retry | |
readRetry, readRefresh, readDirRetry, readAuthorRetry | |
state readEpoch | |
docs, directory and authors take readEpoch | |
epochSeen | |
The timeout and "Couldn't reach the server.", "The server answered N.", "The server sent something unreadable." | |
The caches, generations and forget | |
fetchDocument: redirects, the loop guard, not found and unavailable messages | |
failedPage and loadDoc: a failure comes back with its error and is never cached | |
forgetAll |
Tests
File | What it checks |
|---|---|
a failed load shows Retry and recovers | |
a deep link that is not a document says so | |
failed site loading exposes retry and never substitutes the default home | |
refresh starts a new document request and late old responses cannot replace it | |
refresh epochs are tracked independently for each server | |
redirected documents use the destination for children, discussion and sharing | |
redirect cycles terminate with an actionable document error | |
a failed child listing is a retryable error rather than a cached empty document | |
an invalid SuperJSON annotation is an unreadable response, not silently accepted data |
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime