Allow opening workspace if sync dir not empty

This commit is contained in:
Gregory Schier
2025-02-25 06:54:30 -08:00
parent 2db72fe6ef
commit 7af8c95fea
5 changed files with 48 additions and 24 deletions

View File

@@ -1,20 +1,11 @@
import { open } from '@tauri-apps/plugin-dialog';
import { applySync, calculateSyncFsOnly } from '@yaakapp-internal/sync';
import { createFastMutation } from '../hooks/useFastMutation';
import { showSimpleAlert } from '../lib/alert';
import { router } from '../lib/router';
export const openWorkspaceFromSyncDir = createFastMutation<void>({
export const openWorkspaceFromSyncDir = createFastMutation<void, void, string>({
mutationKey: [],
mutationFn: async () => {
const dir = await open({
title: 'Select Workspace Directory',
directory: true,
multiple: false,
});
if (dir == null) return;
mutationFn: async (dir) => {
const ops = await calculateSyncFsOnly(dir);
const workspace = ops