Skip to content

feat(events): form-library & non-JSX event adapters (B7/B8)#23

Merged
officialCodeWork merged 1 commit into
developmentfrom
build/phase-3/step-3.4-form-events
Jul 14, 2026
Merged

feat(events): form-library & non-JSX event adapters (B7/B8)#23
officialCodeWork merged 1 commit into
developmentfrom
build/phase-3/step-3.4-form-events

Conversation

@officialCodeWork

Copy link
Copy Markdown
Owner

Step 3.4 — Form libraries & non-JSX events

Failure modes B7/B8. Events no longer have to be JSX on* props to be discovered.

  • react-hook-form<form onSubmit={handleSubmit(onValid)}> unwraps to the real handler onValid (the wrapped arg, not the handleSubmit() call); event sourced form.
  • FormikonSubmit on a <Formik>/<Form> tag treated as a submit handler.
  • addEventListenerwindow.addEventListener("keydown", onKey) in an effect → event sourced effect.
  • Hotkey libsuseHotkeys("ctrl+s", fn) (and useKeyboardShortcut/useKey/…) → event sourced hotkey, keyed by the shortcut.
  • Unknown — an unresolvable event type is flagged unscanned-events, never dropped.

All routes funnel through one registerEvent helper that queues the handler for the existing effect-mining pass, so form/effect/hotkey handlers get the same navigate/fetch/dispatch/setState effect edges as JSX handlers.

Schema

EventNode gains optional source: "jsx" | "form" | "effect" | "hotkey"; JSON schema regenerated (drift gate green).

Eval

  • b8-react-hook-formhandleSubmit(onValid)POST /api/signup.
  • b7-effect-listenerskeydown listener and ctrl+s hotkey → /api/save.

Verification

  • 87 parser + 29 core tests pass (3 new event-source tests).
  • pnpm eval: green, precision/recall 1.000.

🤖 Generated with Claude Code

Extend event extraction beyond JSX on* props (TRACKER step 3.4):

- react-hook-form: <form onSubmit={handleSubmit(onValid)}> unwraps to the real
  submit handler (the wrapped argument), event sourced "form".
- Formik: onSubmit on a <Formik>/<Form> tag treated as a submit handler.
- addEventListener("keydown", onKey) inside an effect → event sourced "effect".
- Hotkey hooks (useHotkeys/useKeyboardShortcut/…) → event sourced "hotkey",
  keyed by the shortcut string.
- Unresolvable event type → event flagged "unscanned-events", never dropped.

All routes share one registerEvent helper that queues the handler for the
existing effect-mining pass, so form/effect/hotkey handlers get the same
navigate/fetch/dispatch/setState effect edges as JSX handlers.

Schema: EventNode gains optional `source` ("jsx"|"form"|"effect"|"hotkey");
JSON schema regenerated. Fixtures b8-react-hook-form (POST /api/signup via
handleSubmit) and b7-effect-listeners (keydown + ctrl+s → /api/save) green.
87 parser + 29 core tests pass; eval green (precision/recall 1.000).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@officialCodeWork
officialCodeWork merged commit aa848ab into development Jul 14, 2026
1 check passed
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.

2 participants