"Unknown option block" issue fix, #147

This commit is contained in:
FTCHD
2026-02-12 18:00:16 +03:00
parent 2a5f4aedd9
commit 1c46ec5834
2 changed files with 19 additions and 14 deletions
+13 -12
View File
@@ -3,6 +3,7 @@ import { message } from '@tauri-apps/plugin-dialog'
import { platform } from '@tauri-apps/plugin-os'
import pRetry from 'p-retry'
import { useHostStore } from '../../store/host'
import { useStore } from '../../store/memory'
import type { JobItem } from '../../types/jobs'
import type { FlagValue } from '../../types/rclone'
import { getFsInfo } from '../format'
@@ -18,21 +19,25 @@ const RE_WINDOWS_DRIVE_LETTER = /^[a-zA-Z]:$/
export async function startDryRun<T>(operation: () => Promise<T>): Promise<T> {
await rclone('/options/set', {
params: {
query: {
// @ts-ignore
body: {
main: { DryRun: true },
},
},
})
try {
return await operation()
const result = await operation()
if (typeof result === 'number') {
useStore.setState((state) => ({
dryRunJobIds: [...state.dryRunJobIds, result],
}))
}
return result
} finally {
await rclone('/options/set', {
params: {
query: {
// @ts-ignore
body: {
main: { DryRun: false },
},
},
})
}
}
@@ -418,7 +423,7 @@ async function fetchJob(
console.log('[fetchJob] job status', jobId, JSON.stringify(jobStatus, null, 2))
let hasError = !!jobStatus?.error
let isDryRun = false
const isDryRun = useStore.getState().dryRunJobIds.includes(jobId)
if (
jobStatus.output &&
@@ -429,10 +434,6 @@ async function fetchJob(
if (!hasError) {
hasError = jobStatus.output.results.some((result: any) => !!result?.error)
}
isDryRun = jobStatus.output.results.some((result: any) => {
const srcFs = result.input?.srcFs || ''
return srcFs.includes('dry_run') || srcFs.includes('dry-run')
})
}
const jobCheckingItems = checkingItems.filter((c) => c.group === `job/${jobId}`)
+4
View File
@@ -26,6 +26,8 @@ interface State {
pid: number
url: string
} | null
dryRunJobIds: number[]
}
export const useStore = create<State>()(
@@ -44,6 +46,8 @@ export const useStore = create<State>()(
},
cloudflaredTunnel: null,
dryRunJobIds: [],
}),
{ name: 'shared-store' }
)