Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: register delete_device_local_data in both command blocks, use AlertDialog instead of window.confirm

Louis Beaumontb5db080d6c21
diff --git a/apps/screenpipe-app-tauri/components/settings/sync-settings.tsx b/apps/screenpipe-app-tauri/components/settings/sync-settings.tsx
index 76aa786eb..53d36d08c 100644
--- a/apps/screenpipe-app-tauri/components/settings/sync-settings.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/sync-settings.tsx
@@ -625,14 +625,28 @@ function ActiveSyncSettings({
</div>
{!device.isCurrent && (
<div className="flex items-center gap-1">
- <Button
- variant="ghost"
- size="sm"
- onClick={() => onDeleteDeviceLocalData(device.deviceId)}
- title="delete synced data from this device"
- >
- <span className="text-xs text-muted-foreground">clean local data</span>
- </Button>
+ <AlertDialog>
+ <AlertDialogTrigger asChild>
+ <Button variant="ghost" size="sm" title="delete synced data from this device">
+ <span className="text-xs text-muted-foreground">clean local data</span>
+ </Button>
+ </AlertDialogTrigger>
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogTitle>Clean local data?</AlertDialogTitle>
+ <AlertDialogDescription>
+ This will delete all data synced from {device.deviceName || device.deviceId} on this machine.
+ To re-sync, disable and re-enable cloud sync.
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogCancel>Cancel</AlertDialogCancel>
+ <AlertDialogAction onClick={() => onDeleteDeviceLocalData(device.deviceId)}>
+ Delete
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
<Button
variant="ghost"
size="sm"
@@ -1168,13 +1182,6 @@ export function SyncSettings() {
};
const handleDeleteDeviceLocalData = async (deviceId: string) => {
- const confirmed = window.confirm(
- "this will delete all data synced from this device on your local machine.\n\n" +
- "to re-sync, disable and re-enable cloud sync.\n\n" +
- "continue?"
- );
- if (!confirmed) return;
-
try {
const result = await invoke("delete_device_local_data", { machineId: deviceId });
const parsed = typeof result === "string" ? JSON.parse(result) : result;
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
index 4a30f3362..7620cbb76 100755
--- a/apps/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -795,6 +795,7 @@ async fn main() {
sync::update_sync_config,
sync::get_sync_devices,
sync::remove_sync_device,
+ sync::delete_device_local_data,
sync::init_sync,
sync::lock_sync,
sync::delete_cloud_data,