Skip to content

fix: await autosave before downloading sketch zip#4022

Open
saschabuehrle wants to merge 1 commit intoprocessing:developfrom
saschabuehrle:fix/issue-4021
Open

fix: await autosave before downloading sketch zip#4022
saschabuehrle wants to merge 1 commit intoprocessing:developfrom
saschabuehrle:fix/issue-4021

Conversation

@saschabuehrle
Copy link
Copy Markdown

Bug

#4021 — Downloaded ZIP filename uses the old sketch name instead of the current one when the sketch has been renamed but the rename hasn't been saved to the server yet.

Root cause

In useSketchActions.js, downloadSketch() calls dispatch(autosaveProject()) and then immediately calls exportProjectAsZip(). Since autosaveProject is async (it issues a PUT request to the server), the download URL is opened before the save completes, so the server still has the old name when it generates the ZIP and its Content-Disposition filename.

Fix

await the autosave dispatch so the server has the updated sketch name before the ZIP download begins. The autosaveProject thunk already returns a Promise from the underlying saveProject call, so making the function async and adding await is all that's needed.

Testing

  1. Create and save a new sketch.
  2. Rename the sketch in the editor.
  3. Click File > Download.
  4. Verify the ZIP filename matches the new sketch name.

Happy to address any feedback.

Greetings, saschabuehrle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant