Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Keep the backup export dialog open when the export fails

aivsomkara07a7c54230d
diff --git a/src/components/WorkspaceBackupSettings.test.ts b/src/components/WorkspaceBackupSettings.test.ts
index 6aa352225d..3676e6af41 100644
--- a/src/components/WorkspaceBackupSettings.test.ts
+++ b/src/components/WorkspaceBackupSettings.test.ts
@@ -89,6 +89,19 @@ describe("Settings full backups", () => {
expect(link.click).toHaveBeenCalledOnce();
expect([...storage.values()]).not.toContain("correct horse battery");
expect(render().html).not.toContain('value="correct horse battery"');
+ expect(render().html).not.toContain('id="backup-export"');
+ });
+
+ it("keeps the export dialog open with its reason when the export fails, so it can be tried again", async () => {
+ await ready();
+ open("export");
+ const passwords = render().nodes.filter((node) => node.type === "input" && node.props.type === "password");
+ change(passwords[0], "correct horse battery"); change(passwords[1], "correct horse battery");
+ fixture.api.mockRejectedValueOnce(new Error("Disk full"));
+ submit(formOf("backup-export")); await flush();
+ const html = render().html;
+ expect(html).toContain('id="backup-export"');
+ expect(html).toMatch(/role="alert"[^>]*>Disk full</);
});
it("uploads a raw file, validates it, and requires exact REPLACE with the staged ID", async () => {
diff --git a/src/components/WorkspaceBackupSettings.tsx b/src/components/WorkspaceBackupSettings.tsx
index 3d82ffcb72..e6aa303d2c 100644
--- a/src/components/WorkspaceBackupSettings.tsx
+++ b/src/components/WorkspaceBackupSettings.tsx
@@ -135,6 +135,7 @@ export function WorkspaceBackupSettings({ compact = false }: { compact?: boolean
document.body.append(link);
link.click();
link.remove();
+ setExporting(false);
});
const previewBackup = () => perform("preview", async () => {
@@ -202,7 +203,7 @@ export function WorkspaceBackupSettings({ compact = false }: { compact?: boolean
</SettingsRows>
{exporting && (
<SettingsDialog title={t("backup.export")} onClose={closeExport}>
- <form id="backup-export" className="flex flex-col gap-4" onSubmit={(event) => { event.preventDefault(); void exportBackup().then(() => { if (alive.current) setExporting(false); }); }}>
+ <form id="backup-export" className="flex flex-col gap-4" onSubmit={(event) => { event.preventDefault(); void exportBackup(); }}>
<p className="text-[13px] leading-[18px] text-ink-secondary">{t("backup.passwordHint")}</p>
<SettingsField label={t("backup.exportPassword")}>
<input type="password" autoComplete="new-password" minLength={12} maxLength={1024} required disabled={disabled} value={exportPassword} onChange={(event) => setExportPassword(event.target.value)} className={SETTINGS_INPUT} />