Skip to content

add form-based callbacks - #10

Merged
calebsyring merged 1 commit into
mainfrom
forms
Sep 22, 2026
Merged

calebsyring merged 1 commit into
mainfrom
forms

Conversation

@calebsyring

Copy link
Copy Markdown
Contributor

No description provided.

@augmentcode

augmentcode Bot commented Sep 22, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: Adds native HTML form submission support to Hypergen callbacks.

Changes:

  • Introduces a form=True option on callback().
  • Validates that form callbacks are rendered on identified <form> elements.
  • Emits the form ID as the callback option formId.
  • Builds browser request bodies from the form's native FormData.
  • Appends Hypergen callback metadata to that same multipart payload.
  • Rebuilds the distributed JavaScript bundle and source map.
  • Adds and registers a form-submission example with fields, repeated names, and a file.
  • Adds unit, Flask integration, example-route, and Playwright coverage.
Technical note: Form fields and uploaded files are intended to remain available through Flask's request.form and request.files while callback arguments continue through hypergen_data.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

hypergen.hypergenGlobalFormdata = new FormData()
hypergen.hypergenGlobalFormdata = formId === null
? new FormData()
: new FormData(document.getElementById(formId))

@augmentcode augmentcode Bot Sep 22, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/flask_hypergen/static-src/hypergen.js:190: A native form may legally contain a control named hypergen_data; this FormData retains that value and the framework payload is later appended, so request.form['hypergen_data'] resolves to the user control's first value rather than the callback JSON. Such forms will then fail to decode their callback arguments (or invoke the action with the wrong arguments).

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

@codecov

codecov Bot commented Sep 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.88136% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.43%. Comparing base (2441dcf) to head (afe6a65).

Files with missing lines Patch % Lines
tests/flask_hypergen_tests/test_e2e.py 36.84% 12 Missing ⚠️
tests/flask_hypergen_tests/test_core_ported.py 87.50% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #10      +/-   ##
==========================================
- Coverage   98.07%   97.43%   -0.64%     
==========================================
  Files          13       13              
  Lines        2283     2342      +59     
  Branches      152      153       +1     
==========================================
+ Hits         2239     2282      +43     
- Misses         40       56      +16     
  Partials        4        4              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@calebsyring
calebsyring merged commit ed4635e into main Sep 22, 2026
4 of 6 checks passed
@calebsyring
calebsyring deleted the forms branch September 22, 2026 18:01
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