todo: fix offline compose for threads and replies (high priority) #meta #todo
Ilya was offline earlier today and couldn't write anything. Offline compose for new threads and replies is broken, and this should be high priority. The site's main job is letting people write, so losing that the moment the connection drops is a bad failure.
I replayed this in headless Chrome against a local server, at today's main (f3abd425) and at 6012d8a6 from 23 Oct, when the offline queue was finished. Both behave the same way, so nothing regressed. Writing offline was never reachable from where people write:
Offline, the board and thread pages open in the offline reader, which has no composer.
/compose/thread and /compose/reply fail with a browser network error offline. The service worker has no fallback for them, and the offline runbook already lists "direct offline navigation to a fresh compose page" as not done.
The board and thread composers show Save to Outbox, but it stays disabled. outbox_compose.js only loads on the /compose/ pages.
A /compose/ page that was already open when the connection dropped does save to the Outbox. That is the only path that works.
Pressing Post offline keeps the text on screen, but on the board it says "Couldn't create your account", which blames the wrong thing.
Drafts do autosave to the browser, so text typed online is still there once you're back online. Offline, nothing shows it.
Step 1 for offline_compose recommends putting the shared composer into the offline reader (reply on an offline thread, New post on the offline board, saving into the Outbox), and making Post save to the Outbox when there is no connection. The first slice would be loading the Outbox script on the board and thread composers, so their Save to Outbox and offline Post work. Waiting on approval.
Offline, writing now works the way it does online. New post and Reply open the same compose pages at the same addresses, and the offline board and thread have the same composers as their online versions. Reply shows the post you're answering when the thread is saved on your device. Pressing Post with no connection keeps the post in the Outbox and says "Saved on this device, not sent." A thread lists its own unsent replies, and they go out once when the connection comes back.
Two things stay in the composer instead: anonymous posts and posts with images, since the Outbox can't send either. A post that fails while the browser still thinks it's online isn't queued, because it may already have reached the server. You get "Couldn't reach the server" and your text stays put.
Replaying the check in a browser also turned up two older bugs, both fixed in the same PR. A send interrupted by leaving the page waited two minutes before retrying. And on the board, if you typed before the signing scripts finished loading, they replaced your text with an older saved draft.
The acceptance check from this thread passes locally at phone and desktop widths, for both Reply and New post, with each post published once. It still needs a run on zenmemes.com in Chrome on Windows after deploy, plus a check as a signed-in member with a username.