Repository navigation
feat: own Three discrete event commits at the renderer boundary - #2111
Merged
domgan-oai merged 2 commits intoOct 15, 2026
Merged
domgan-oai merged 2 commits into
domgan-oai merged 2 commits into
Conversation
domgan-oai
marked this pull request as ready for review
October 15, 2026 23:32
Contributor
Benchmark report
Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)
11 other measured values are unchanged. Public-import reachability bundles (bytes)
38 other measured values are unchanged. |
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
Three's default web event manager uses the DOM renderer's global
flushSyncfor discrete mesh events, making it a Strong dependency boundary and admitting unrelated task-held transitions. Adapt discrete listeners once at event-manager construction so their ordinary DOM updates commit before the native listener returns while deferred transitions keep their scheduler ownership. Continuous event handling is unchanged.Related to #2059.
Why
Removing the wrapper alone makes a mesh click's DOM update invisible to later native listeners and the dispatching script until a microtask. Three's scene event scope cannot own that cross-renderer DOM commit.
Changes
Validation
pnpm format:check(scoped changed-file check passed)pnpm typecheck(affected source selection and Three owning program passed)pnpm test(targeted suites run locally; full workspace delegated to CI)d65e896and signed head2c48e67; homepage flame hydration, idle rotation, drag/cursor, reduced-motion behavior, client navigation, and canvas teardown match. The homepage uses native canvas listeners, so the separate real mesh fixture is the timing proof: main and candidate exposeselectedto the later listener and immediately after dispatch; deleting the wrapper exposesidleuntil the microtask. Both revisions had the same existing Lynx teardown diagnostics after navigation and no failed/HTTP-error requests.src/web/events.tsdrops out, leaving Routercompiled/MatchLifecycle.tsrxandcompiled/RouterProvider.tsrx.pnpm syncpassed and left the worktree clean.perf-review: exactd65e896..2c48e67shipped-source diff scan: 0 candidates. Hot paths: native read scheduling (runtime.ts:1828), Action/update classification (:3298,:3675,:8118), first-root admission (:51790), and discrete listener dispatch (:31614;three/src/web/events.ts:29). No hot-record shape changes, per-event closure, DOM measurement, new task poster, or extra microtask chain. Flag reads are short-circuited behind the relevant Action/native-producer paths; the wrapper is allocated once per discrete listener. The shared-runtime byte cost is measured above; PR benchmark counters and bundle rows remain CI evidence.concise-code: shipped source +72/−10 (Octane runtime +66/−6); one internal adapter exported through paired client/server surfaces, no new runtime module or record field, one release changeset. Deletion breaks same-task DOM timing; reusing delegated propagation depth breaks nested controlled restoration; retaining globalflushSynckeeps the Strong boundary and admits unrelated deferred work.Risk / follow-ups
Eligible ordinary work and effects can still commit across roots; the boundary is narrower than an all-priority global flush, not root-isolated. Explicit transitions retain scheduler ownership. Full upstream React Three Fiber parity was not established by these focused checks. The remaining Router boundaries, descriptor elimination, and package declarations/enforcement stay under #2059.
Provenance
agent-authored)Origin: Codex task · host
com-79386.Need help on this PR? Tag
@codesmith-botwith what you need.Note
Medium Risk
Touches core update-priority and transition scheduling in
runtime.ts; incorrect depth handling could mis-classify urgent vs transition work, though behavior is heavily regression-tested.Overview
Adds
__createDiscreteEventListener, an internal Octane helper that commits urgent renderer work before a native listener returns while not treating that window like an in-flight async Action or deferred transition.The client scheduler tracks
RENDERER_DISCRETE_EVENT_DEPTHso updates during renderer-owned discrete events stay urgent, implicit first-root mounts from those listeners do not queue as ViewTransitions, and unrelated task-held transitions are not admitted. The server stub is a no-op identity wrapper.@octanejs/threeswitches discrete canvas handlers from globalflushSyncto this adapter (module markeduse strong) and aligns its Octane peer with coordinated core consumers. Octane and Three get patch changesets; tests cover controlled-input nesting, async-Action interaction, and a real WebGL mesh click proving DOM updates are visible before dispatch returns.Reviewed by Cursor Bugbot for commit 2c48e67. Bugbot is set up for automated code reviews on this repo. Configure here.