timescale.info
Sign inSign up

How OpenChronology was built

Every merged pull request of openchronology/timeline-app, its first week of commits and its releases; and before them the 2020 PureScript editor, from snapshots of its deleted repositories in the Wayback Machine. Written to this server through the HTTP API.

327 moments · 2020-03-09T00:15:08Z CE – 2026-11-02T20:11:21Z CE · by @athan · @athan

#190 · Browser drafts: each timeline its own, listed on the dashboard (#188)

  • timeline-app
  • pull request

Closes #188. Signed in, every timeline you start or import in the browser is now a draft of its own. Starting another, importing a file or loading the sample no longer replaces the draft you had. ## How it works - **Storage:** each draft has its own IndexedDB database, stored record by record exactly as before (`drafts.ts`). - The first draft stays in the database the single draft always used, so existing drafts, including the oldest whole-document kind, open as before with nothing to migrate. - A list in `src/draft-store.ts` records each draft's title, moment count, account and when it was last edited. - **When a timeline becomes a draft:** - a new timeline, or the sample, when first edited (no empty drafts pile up); - an imported file at once. - **Nothing asks to replace a draft:** switching away from a stored draft no longer prompts, because the draft is kept. If its save was still waiting (saves follow edits by 0.7 s), it's stored first. - **Tied to the open timeline:** a draft is bound to the timeline it belongs to. Opening anything else, however it's opened, leaves it, so a later save of a server timeline can't touch an unrelated draft. - **Saved to the server:** a saved draft is on the server now, and it leaves the list. - **Other accounts:** another account signed in on the same browser sees none of your drafts. Drafts from before the list, which have no owner, are shown to whoever is signed in, as before. ## Where you see them - **Drafts in this browser** on the website's home page, and on the editor's own dashboard: - your drafts, most recently edited first, each with its moment count and when it was edited; - choose one to open it (`/editor?draft=…`), or **Delete** it, after confirming. - **Opening the editor** without choosing returns to the draft edited last, as it did with one draft. ## Docs The guide ("Drafts and signing in"), the FAQ and the README say how drafts work now. ## Tests - **`drafts-browser.mjs`**, extended: - the old draft kinds still open and convert; - starting a second timeline asks nothing and keeps the first; - an untouched new timeline and the untouched sample are not drafts, while an edited one and an imported file are; - the dashboard lists them newest first, opens one, and deletes one after confirming; - `?draft=` opens a chosen draft; - saving a draft to the server removes it; - another account sees no drafts. - **`sharing-postgres.mjs`:** a timeline started on the website is listed on its dashboard with a `/editor?draft=…` link, and opens from there. Locally, all of the following pass: - 286 unit tests, typecheck and Prettier; - the 11 browser suites; - the offline edition's test. I also checked the dashboard section by eye at desktop and phone widths.

Sources

Open #190 · Browser drafts: each timeline its own, listed on the dashboard (#188) in the timeline