feat(events): form-library & non-JSX event adapters (B7/B8)#23
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 3.4 — Form libraries & non-JSX events
Failure modes B7/B8. Events no longer have to be JSX
on*props to be discovered.<form onSubmit={handleSubmit(onValid)}>unwraps to the real handleronValid(the wrapped arg, not thehandleSubmit()call); event sourcedform.onSubmiton a<Formik>/<Form>tag treated as a submit handler.window.addEventListener("keydown", onKey)in an effect → event sourcedeffect.useHotkeys("ctrl+s", fn)(anduseKeyboardShortcut/useKey/…) → event sourcedhotkey, keyed by the shortcut.unscanned-events, never dropped.All routes funnel through one
registerEventhelper that queues the handler for the existing effect-mining pass, so form/effect/hotkey handlers get the samenavigate/fetch/dispatch/setStateeffect edges as JSX handlers.Schema
EventNodegains optionalsource: "jsx" | "form" | "effect" | "hotkey"; JSON schema regenerated (drift gate green).Eval
b8-react-hook-form—handleSubmit(onValid)→POST /api/signup.b7-effect-listeners—keydownlistener andctrl+shotkey →/api/save.Verification
pnpm eval: green, precision/recall 1.000.🤖 Generated with Claude Code