Skip to content

fix(feedback): catch reCAPTCHA errors and show actionable failure UI#44

Draft
thostetler wants to merge 8 commits intomasterfrom
fix/recaptcha-silent-failure
Draft

fix(feedback): catch reCAPTCHA errors and show actionable failure UI#44
thostetler wants to merge 8 commits intomasterfrom
fix/recaptcha-silent-failure

Conversation

@thostetler
Copy link
Member

When reCAPTCHA fails to load (e.g. blocked by an ad blocker or network issue), the correct-abstract form silently swallowed the error — the modal closed with no feedback to the user.

  • Move await execute() inside the try/catch in SubmitCorrectAbstract/FormPreview so reCAPTCHA rejections are caught like any other submission error
  • Make SubmissionState error variant's code field optional so string-only rejections (no HTTP status) are representable
  • Update FormStatus to branch on reCAPTCHA errors with a friendly "security check" message, and on all error paths render a copyable diff block so users can email adshelp@cfa.harvard.edu as a fallback
  • Add @testing-library/react component tests covering the reCAPTCHA failure path and FormStatus rendering
  • Add tsconfig.build.json to exclude test files from the rollup type-check pass

- Add @testing-library/react@^11.0.0 for component tests
- Use tsconfig.build.json to exclude test files from rollup type-check pass
- Use string[][] instead of [string[]] tuple for DeferFn-compatible
  fetchBibcodes signatures (TS2769)
- Separate type re-exports with 'export type' for isolatedModules
  compliance in api/index.ts and hooks/index.ts (TS1205)
- Annotate reduce accumulator types in DiffView to fix strict
  inference of never[] (TS2769)
- Add nullish-coalescing guards for optional count fields in
  DiffView (TS2532)
- Commit tsconfig.json additions (isolatedModules, strict, etc.)
  that were being modified by tooling
useRecaptcha hook now loads the reCAPTCHA script on mount instead of
assuming it was loaded by legacy code. Error states use AlertModal
(closable dialog) instead of inline banners for actionable errors.
- Replace details/summary with clipboard copy button for email fallback
- Add key props to AlertModal to prevent stale state across status transitions
- Skip reCAPTCHA when siteKey is missing for local dev
- Suppress unhandled rejection from script load on mount
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