mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-12-01 04:24:03 +01:00
Remove useNavigate everywhere, and make request a query param. And convert dialog to Jotai
This commit is contained in:
1 parent
806a8eb801
commit
bc50891edb
54 files changed
+592
-545
No files matched your search
@@ -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 () => {
|
||||
|
||||
Reference in new issue
Block a user