Skip to content

fix: reject pickJsonFile promise when user cancels file picker#4

Merged
jonathan-beebe merged 2 commits into
mainfrom
fix/002-file-picker-cancel-never-resolves
Mar 29, 2026
Merged

fix: reject pickJsonFile promise when user cancels file picker#4
jonathan-beebe merged 2 commits into
mainfrom
fix/002-file-picker-cancel-never-resolves

Conversation

@jonathan-beebe
Copy link
Copy Markdown
Owner

Summary

  • pickJsonFile() in src/io.ts left its Promise pending forever when the user cancelled the file dialog, since onchange never fires on cancel
  • Added input.oncancel handler to reject the Promise with a descriptive error
  • Added src/__tests__/io.test.ts with tests for both the happy path and cancel path

Closes BUG-002.

Test plan

  • New cancel test confirms the promise rejects (timed out before the fix)
  • Happy-path test confirms file selection still works
  • Full test suite passes (210 tests)

🤖 Generated with Claude Code

The cancel event on <input type="file"> was not handled, leaving the
promise pending forever when the user dismissed the file dialog. Add an
oncancel handler that rejects with a descriptive error.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 29, 2026

Deploy Preview for golden-scone-6bfeb1 ready!

Name Link
🔨 Latest commit 95b223d
🔍 Latest deploy log https://app.netlify.com/projects/golden-scone-6bfeb1/deploys/69c93ab3cdad410008065926
😎 Deploy Preview https://deploy-preview-4--golden-scone-6bfeb1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Cancelling a file picker is a normal user action, not an error. Resolve
with null so callers can silently ignore it rather than surfacing an
error to the user.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jonathan-beebe jonathan-beebe merged commit f36816d into main Mar 29, 2026
5 checks passed
@jonathan-beebe jonathan-beebe deleted the fix/002-file-picker-cancel-never-resolves branch March 29, 2026 14:47
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