Skip to content

fix: add timeout guard and error fallback to PDF generator pipeline#112

Open
RensTillmann wants to merge 1 commit intomasterfrom
claude/issue-102-20260326-2244
Open

fix: add timeout guard and error fallback to PDF generator pipeline#112
RensTillmann wants to merge 1 commit intomasterfrom
claude/issue-102-20260326-2244

Conversation

@RensTillmann
Copy link
Copy Markdown
Owner

Description

Adds a 120-second watchdog timer to the PDF generator so the form UI cannot freeze indefinitely if generation stalls. Surfaces errors to the user instead of silently breaking.

Fixes #102

Target Branch

  • master

Super Forms Version

Targets version: v6.4.201

User Population Affected

  • Add-on users only — add-on name: PDF Generator

Type of Change

  • Bug fix (non-breaking)

Backward Compatibility Checklist

  • No super_* hook or filter name was renamed or removed
  • No [super_form] shortcode attribute was removed or renamed
  • No Action Scheduler hook name was changed
  • No WordPress option key renamed

For AI-Generated PRs

Source issue: #102
Implementation confidence: ready
Files modified: src/includes/extensions/pdf-generator/, src/super-forms.php
New hooks added (if any): none
Migration required: no

- Add `SUPER.pdf_generator_abort()` helper that clears the watchdog
  timer, resets form state, and shows an error in the loading overlay
- Start a 120-second watchdog in `pdf_generator_init` so the UI can
  never freeze indefinitely if PDF generation stalls
- Clear the watchdog in `_pdf_generator_done_callback` on success
- Add `.catch()` to the `html2canvas` promise so async render failures
  are caught and surfaced to the user instead of silently breaking the
  callback chain
- Replace the bare `console.log` in the outer `catch` block with a call
  to `pdf_generator_abort` so synchronous setup errors also recover
- Add `pdf_generation_error` i18n string to the `loadingOverlay` array
  in `super-forms.php`

Fixes #102

Co-authored-by: Rens Tillmann <RensTillmann@users.noreply.github.com>
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.

PDF Generator freezes on submit with no timeout or error fallback

1 participant