Skip to content

Commit 0c8a360

Browse files
committed
fix(desktop): confirm before discarding an incomplete recording
The recovery toast's Discard button deleted the whole recording folder straight away. Ask first, with the same prompt the library's delete button and the GPUI app's Discard already use. Fixes #2365
1 parent a32e480 commit 0c8a360

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎apps/desktop/src/components/RecoveryToast.tsx‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Button } from "@cap/ui-solid";
22
import { createMutation } from "@tanstack/solid-query";
3+
import { ask } from "@tauri-apps/plugin-dialog";
34
import { createSignal, onMount, Show } from "solid-js";
45
import { commands, type IncompleteRecordingInfo } from "~/utils/tauri";
56

@@ -112,7 +113,16 @@ export function RecoveryToast() {
112113
{recoverMutation.isPending ? "..." : "Recover"}
113114
</Button>
114115
<Button
115-
onClick={() => discardMutation.mutate(rec().projectPath)}
116+
onClick={async () => {
117+
const projectPath = rec().projectPath;
118+
if (
119+
!(await ask(
120+
"Are you sure you want to delete this recording?",
121+
))
122+
)
123+
return;
124+
discardMutation.mutate(projectPath);
125+
}}
116126
disabled={isProcessing()}
117127
variant="gray"
118128
size="xs"

0 commit comments

Comments
 (0)