mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-08-25 04:44:12 +02:00
Route all app commands through a single RPC envelope (#542)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
1f91cddab9
commit
23e7229e63
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user