Auto-refresh the active tab's panels (silent, non-disturbing)

Local panels are fs.watched (LocalDirWatcher + setWatchedDirs -> pathRefresh);
remote panels poll every 3s. New refresh({silent}) skips the loading/busy
flags and touches no DOM, snapshotting sessionId+cwd to discard results if the
user navigated mid-flight. Only the active tab is live; switching tabs
refreshes the new pair. A future on/off setting is left as commented
breadcrumbs. Docs updated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-14 14:03:35 +02:00
co-authored by Claude Fable 5
parent 260e2d64b2
commit ee5a9e13e6
10 changed files with 206 additions and 15 deletions
+9
View File
@@ -5,6 +5,7 @@ import type { PanelContextMenu } from "./context-menu";
import { readFileText, writeFileText, type EditManager } from "./edits";
import { listLocalDrives } from "./fs/local";
import type { SessionRegistry } from "./fs/registry";
import type { LocalDirWatcher } from "./fs/watcher";
import { SftpProvider } from "./fs/sftp";
import type { ConnectionStore } from "./store/connections";
import type { SettingsStore } from "./store/settings";
@@ -24,6 +25,7 @@ export interface AppDeps {
settings: SettingsStore;
edits: EditManager;
contextMenu: PanelContextMenu;
watcher: LocalDirWatcher;
/** Assigned after the rpc object exists (it needs rpc.send). */
events: {
sessionClosed: (info: { sessionId: string; reason: string }) => void;
@@ -121,6 +123,7 @@ export function createAppRPC({
settings,
edits,
contextMenu,
watcher,
events,
}: AppDeps) {
return BrowserView.defineRPC<AppRPC>({
@@ -160,6 +163,12 @@ export function createAppRPC({
return { path: dir, entries: await fs.list(dir) };
}),
setWatchedDirs: ({ dirs }) =>
wrap(async () => {
watcher.setWatched(dirs);
return {};
}),
mkdir: ({ sessionId, path }) =>
wrap(async () => {
await registry.get(sessionId).mkdir(path);