Skip to content

Fix Scratch import/export reliability in IDE#99

Merged
TopProjectsCreator merged 1 commit into
mainfrom
codex/fix-export-and-import-scratch-functionality/2026-04-18
Apr 18, 2026
Merged

Fix Scratch import/export reliability in IDE#99
TopProjectsCreator merged 1 commit into
mainfrom
codex/fix-export-and-import-scratch-functionality/2026-04-18

Conversation

@TopProjectsCreator
Copy link
Copy Markdown
Owner

Motivation

  • Prevent assets from being dropped during Scratch export when fileNames is stale or incomplete.
  • Make the Scratch import/export UI more robust so users can re-import the same file and downloads behave reliably in browsers.

Description

  • Update exportSb3 in src/services/scratchSb3.ts to export the union of archive.fileNames and Object.keys(archive.files) so assets present in files are always included.
  • Harden handleImport in src/components/scratch/ScratchPanel.tsx by resetting the hidden file input value after each import attempt (importInputRef.current.value = '') so the same file can be re-imported.
  • Wrap handleExport in src/components/scratch/ScratchPanel.tsx with try/catch, use a safer browser download flow (document.body.appendChild(a)a.click()a.remove() → delayed URL.revokeObjectURL), and surface failures via setVmError.
  • Add a regression test src/test/scratchSb3.test.ts that verifies assets in files are exported even when fileNames only contains project.json.

Testing

  • Ran npm test -- --run src/test/scratchSb3.test.ts, which completed successfully with 2 tests passed.
  • Existing round-trip import/export test still passes after the change.

Codex Task

@TopProjectsCreator TopProjectsCreator added the codex This has been or will be assigned to codex for development label Apr 18, 2026 — with ChatGPT Codex Connector
@TopProjectsCreator TopProjectsCreator merged commit 38d90fb into main Apr 18, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex This has been or will be assigned to codex for development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant