Remove useNavigate everywhere, and make request a query param. And convert dialog to Jotai

This commit is contained in:
Gregory Schier
2025-01-06 16:54:07 -08:00
parent 806a8eb801
commit bc50891edb
54 changed files with 592 additions and 545 deletions

View File

@@ -15,7 +15,6 @@ export async function calculateSync(workspace: Workspace) {
}
export async function applySync(workspace: Workspace, syncOps: SyncOp[]) {
console.log('Applying sync', syncOps);
return invoke<void>('plugin:yaak-sync|apply', {
workspaceId: workspace.id,
dir: workspace.settingSyncDir,
@@ -23,17 +22,14 @@ export async function applySync(workspace: Workspace, syncOps: SyncOp[]) {
});
}
export function useWatchWorkspace(workspace: Workspace | null, cb: (e: WatchEvent) => void) {
export function useWatchWorkspace(workspace: Workspace | null, callback: (e: WatchEvent) => void) {
const workspaceId = workspace?.id ?? null;
useEffect(() => {
if (workspaceId == null) return;
console.log('Watching workspace', workspaceId);
const channel = new Channel<WatchEvent>();
channel.onmessage = (event) => {
cb(event);
};
channel.onmessage = callback;
const promise = invoke<WatchResult>('plugin:yaak-sync|watch', { workspaceId, channel });
return () => {