Reload a tab when you switch to it if the file changed on disk while it was in the background
What problem would this solve?
I keep several drafts open as tabs while scripts update them in the background (they stamp a status line in the frontmatter once something posts). Auto-Reload works for the tab I'm looking at, but a tab that was in the background when its file changed still shows the old content after I switch back to it. Nothing tells me it's stale, so I end up refreshing every tab by hand to be sure.
From the source this looks deliberate rather than a bug: each window has one watcher that follows the active file (followActiveFile in src/lib/sessions/fileWatch.svelte.ts, and the comment at documentSession.svelte.ts:309 says "the watcher only ever follows the active file"). Nothing re-reads a tab that has already loaded when it becomes active again, so a change that lands while it's in the background is never picked up.
What would you like?
When a tab becomes active, check whether its file changed on disk since it was loaded. If it did:
- clean tab with Auto-Reload on: reload it, same as a live change
- clean tab with Auto-Reload off: show that it changed and offer a reload
- tab with unsaved changes: show the existing conflict bar (Reload / Compare / Keep mine)
Related: #295 (Live Mode reloading the wrong tab after an external change).
Has another app got this right?
VS Code, as far as I know: a clean editor picks up changes from disk even if its tab wasn't visible when they happened.
Which platform is this for?
All platforms
Your Markpad version and how you installed it
2.9.2 · Homebrew cask (macOS)
You read the code right: the watcher only follows the active tab, and switching tabs didn't re-read the file. #1110 makes switching to a tab check its file. If it changed, a clean tab reloads (with Auto-Reload on), a tab with unsaved edits gets the conflict bar, and otherwise it's left alone, the same rules as a live change. Showing a notice when Auto-Reload is off is a separate follow-up.