Route all app commands through a single RPC envelope (#542)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Gregory Schier
2026-08-14 14:16:14 -07:00
committed by GitHub
co-authored by Claude Fable 5
parent 1f91cddab9
commit 23e7229e63
37 changed files with 2473 additions and 395 deletions
+8 -7
View File
@@ -64,22 +64,23 @@ export function useGitWorktreeStatus(dir: string, refreshKey?: string) {
}
export function watchGitWorktreeStatus(dir: string, callback: (status: GitWorktreeStatus) => void) {
const unlistenPromise = platform.rpcStream<GitWatchResult, GitWorktreeStatus>(
const handle = platform.rpcStream<GitWatchResult, GitWorktreeStatus>(
"cmd_git_watch_worktree_status",
{ dir },
callback,
);
void unlistenPromise
.then(({ unlistenEvent }) => {
addGitWatchKey(unlistenEvent);
void handle
.then(({ result }) => {
addGitWatchKey(result.unlistenEvent);
})
.catch(console.debug);
return () =>
unlistenPromise
.then(async ({ unlistenEvent }) => {
unlistenGitWatcher(unlistenEvent);
handle
.then(async ({ result, unlisten }) => {
unlistenGitWatcher(result.unlistenEvent);
unlisten();
})
.catch(console.error);
}