Repository navigation
perf: skip unused delegated capture fallback tasks - #1017
Merged
domgan-oai merged 1 commit intoSep 9, 2026
Merged
domgan-oai merged 1 commit into
domgan-oai merged 1 commit into
Conversation
Closed
68 of 84 tasks
domgan-oai
marked this pull request as ready for review
September 9, 2026 14:41
14 of 21 tasks
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.
Summary
Why
An authored capture handler makes
finishCaptureDispatchschedulesetTimeout(..., 0)for every trusted discrete event even when ordinary root bubbling closes the dispatch boundary. The timer then observes that bubble already ran and does no work.Changes
input/change/clicktargets a native input, textarea, or select that could become controlled before its bubble is stopped. Other captured discrete events skip it.Validation
pnpm format:check(scopedpnpm format:files:checkpassed for all changed files)pnpm typecheckpnpm test(current-head CI will run the full suite)discrete-dispatch-commit-timing.test.tsinoctaneandoctane-prod(28/28), adjacent capture/dedup/controlled-restore suites in both modes (34/34), real Chromiumevent-boundaries.test.ts(28/28)node benchmarks/event-delegation/work.mjs(production Chromium, all deterministic work gates passed)pnpm sync, stagedgit diff --checkRisk / follow-ups
Captured form-control edit events retain the conservative fallback even when the target was uncontrolled at capture, because a native listener can arm it before stopping propagation. No change to native event routing or the separate signal event batch fallback.
Provenance
agent-authored)Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Changes discrete-event dispatch-boundary timing for controlled form restores; behavior is narrowed with conservative form-control guards but still affects core event delegation.
Overview
Stops scheduling no-op
setTimeout(0)capture fallback tasks for ordinary bubbling discrete events when authored capture is registered but nothing needs a post-dispatch controlled restore.finishCaptureDispatchnow returns early unless a restore is already queued from a nested dispatch, or the event is a restore-capable type (input/change/click) whose target isinput,textarea, orselect(so a native listener can still arm control and stop propagation before bubble). Clicks that complete delegation without that work no longer enqueue a timer that only discovers the bubble already ran.Validation added: a Chromium work gate runs 16 trusted button clicks with capture/bubble order checks and asserts zero zero-delay timers during each click’s delivery (baseline was 16). Two dispatch-commit tests cover nested input restore when an outer click stops bubbling, and restore when an input becomes controlled after capture via a native target listener.
Reviewed by Cursor Bugbot for commit 22be2fa. Bugbot is set up for automated code reviews on this repo. Configure here.