Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(export): surface GIF cancel request failures

超超超超超级喜欢你的达妮娅2b78cfc7861a
diff --git a/src/components/ai-edition/ExportDialog.cancel.test.tsx b/src/components/ai-edition/ExportDialog.cancel.test.tsx
index df5b5bb10..ea573be11 100644
--- a/src/components/ai-edition/ExportDialog.cancel.test.tsx
+++ b/src/components/ai-edition/ExportDialog.cancel.test.tsx
@@ -185,6 +185,17 @@ describe("GIF export cancellation", () => {
expect(toast.success).toHaveBeenCalledOnce();
});
+ it("surfaces a rejected cancel request instead of keeping the progress view", async () => {
+ vi.mocked(cancelGifExportNative).mockRejectedValueOnce(new Error("cancel ipc failed"));
+ pendingExport();
+ await start();
+ fireEvent.click(screen.getByRole("button", { name: "Cancel" }));
+ await waitFor(() => expect(screen.getByText("cancel ipc failed")).toBeVisible());
+ expect(toast.error).toHaveBeenCalledWith("cancel ipc failed");
+ expect(toast.success).not.toHaveBeenCalled();
+ expect(screen.queryByText(/Rendering frames/i)).not.toBeInTheDocument();
+ });
+
it("reports success when native publication wins the race", async () => {
vi.mocked(cancelGifExportNative).mockResolvedValue({ accepted: false });
const job = pendingExport();
diff --git a/src/components/ai-edition/ExportDialog.tsx b/src/components/ai-edition/ExportDialog.tsx
index 8ad676e85..980233995 100644
--- a/src/components/ai-edition/ExportDialog.tsx
+++ b/src/components/ai-edition/ExportDialog.tsx
@@ -296,7 +296,10 @@ export function ExportDialog({ open, onClose, document }: ExportDialogProps) {
if (activeExport.current !== job) return;
job.cancelRequested = false;
setCancelPending(false);
- setError(err instanceof Error ? err.message : String(err));
+ const message = err instanceof Error ? err.message : String(err);
+ setError(message);
+ setPhase("error");
+ toast.error(message);
}
};