diff --git a/assets/todo-rail.js b/assets/todo-rail.js index 87f7a9d..bb0746e 100644 --- a/assets/todo-rail.js +++ b/assets/todo-rail.js @@ -3,10 +3,14 @@ // a plain read view paints first (fast, no dependency), then a minimal // CodeMirror instance (todo.txt highlighting from the bundle) always mounts — // lazily, off the critical path, so the bundle fetch never delays first paint. -// Autosave is debounced + saves on blur via POST /_todo. If the file is absent -// (GET /_todo → 404) the widget renders nothing and no FAB is created; the -// file is only ever created out-of-band. Mobile: a dedicated todo FAB opens -// the widget in the full-viewport Overlay (overlay.js), saving on dismiss. +// Autosave is debounced + saves on blur via POST /_todo. While the tab is +// visible the widget polls /_todo (conditional GET, ETag) and reloads when +// another device changed the file — but only while the local buffer is clean, +// so an active typist is never interrupted (last-write-wins on a real clash). +// If the file is absent (GET /_todo → 404) the widget renders nothing and no +// FAB is created; the file is only ever created out-of-band. Mobile: a +// dedicated todo FAB opens the widget in the full-viewport Overlay +// (overlay.js), saving on dismiss. (function () { var container = document.querySelector('[data-todo-rail]'); if (!container) return; @@ -14,10 +18,11 @@ var TODO_URL = '/_todo'; var DEBOUNCE_MS = 800; var RETRY_MS = 5000; + var POLL_MS = 15000; // external-change check cadence (visible tab only) var view = null; // CM EditorView once mounted var fallback = null; //