Skip to content

VS Code extension: autosave fires a "Save File" dialog on every edit (export() called without triggerDownload: false) #3768

Description

@ToddSD007

Summary

Editing any .docx opened with the SuperDoc VS Code extension pops a browser "Save File" dialog (default name SuperDoc.docx) roughly once per second of typing. Edits do persist to the underlying file (the postMessage save path works), but the recurring dialog makes real editing unusable.

Environment

  • superdoc-vscode-ext 2.15.0
  • macOS (VS Code custom-editor webview)

Steps to reproduce

  1. Open any .docx with the SuperDoc editor.
  2. Type a few characters and pause.
  3. ~1s later a "Save File" dialog appears (suggested name SuperDoc.docx). It recurs on essentially every edit.

Root cause

In dist/webview/main.js, the debounced autosave calls:

const blob = await editor.export({ format: "docx" });

SuperDoc's export() defaults triggerDownload to true:

async export({ exportType = ["docx"], /* ... */, triggerDownload = true, /* ... */ } = {}) {
  // ...
  if (blobsToZip.length === 1) {
    if (triggerDownload) return createDownload(blobsToZip[0], baseFileName, exportType[0]); // <-- showSaveFilePicker
    return blobsToZip[0];
  }
  // ...
}

With triggerDownload left at its default, export() returns createDownload(...), which calls window.showSaveFilePicker inside the webview. Because both the debounced autosave (AUTO_SAVE_DELAY = 1000) and the Cmd/Ctrl+S handler call saveDocument(), the picker fires on virtually every edit.

(Minor: format is not a recognized export() option; the intended key is exportType.)

Fix

Pass triggerDownload: false so export() returns the blob without triggering a download:

const blob = await editor.export({ exportType: ["docx"], triggerDownload: false });

Verified locally against 2.15.0: the dialog no longer appears, and the silent autosave-to-disk continues to work (edits persist across tab switches).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions