You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit be82cf3
Browse filesBrowse the repository at this point in the historyBrowse files
authored
fix(signals,web): one interaction frame per event, joinable by outside listeners (#3754) (#3877)
* fix(signals,web): one interaction frame per event, joinable by outside listeners (#3754)
The runtime opened an interaction frame per listener and recorded it as soon
as that handler returned, so a document-level listener (a router's anchor
click) either ran outside any frame or produced a second record for the same
click. InteractionRef takes an optional `event`; frames sharing it re-enter
one record, which stays joinable until the next task. The web runtime keys
its frames by the DOM event, and `dispatchAsInteraction` is exported so
outside listeners can join.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* fix(signals): the per-event finalize timer does not hold the Event; InteractionRef.event is a join key only (#3754)
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
* size: raise the engine-enabled observe cap for #3877 (Size-Exception, accepted 2026-10-07)
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
---------
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Observe: one interaction frame per event, not per listener. `InteractionRef` takes an optional `event`; frames with the same `event` re-enter one interaction record, which stays joinable for the event's dispatch and is recorded at the next task. The web runtime keys its frames by the DOM event, and `@solidjs/web` exports `dispatchAsInteraction(e, fn)` so a listener outside the runtime (a router's `document` click handler) joins the frame of the same event — `fn()` in production builds. One anchor click is now one interaction record carrying both the `onClick` work and the navigation (#3754).
// A router declares a navigation around its location write — match eagerly,
1085
1092
// describe by the parametrized route, then write. This is the only
1086
1093
// router-specific line anywhere; the engine knows no router.
@@ -1178,11 +1185,12 @@ Known gap: handlers bound through the runtime (delegated events, and non-literal
1178
1185
1179
1186
The interaction is the unit a person experiences: one click, and everything it cost until the screen had the answer. Every downstream fact is already keyed to the interaction frame — writes stamp it, re-runs trace to it through their causes, holds and navigations carry it — and `feedback().interactions` folds those by interaction _name_. `history("interaction")` keeps one `InteractionEvent` per dispatch instead (delivered on `OBSERVE.records.subscribe("interaction", …)` as it settles), with a start, an end, and the pieces attached, so a consumer building a span per interaction (an APM adapter) neither infers the end from an idle gap nor sums quantized per-run times to approximate the wall clock:
1180
1187
1181
-
- `name`, `target`, `at` — what the runtime described to `withInteraction` (`at` the event's own `timeStamp` when it was given, else the dispatch); `inputDelayMs` — the browser's queueing from `at` to the handler's entry, present when `at` predates it; `handlerMs` — the handler itself, entry to return.
1188
+
- One record per **event**, not per listener: the web runtime hands the engine the DOM event as the frame's join key (`InteractionRef.event`), so the delegated listener of every root, each runtime-attached listener and any outside listener wrapped in `dispatchAsInteraction(e, fn)` (a router's `document` click handler) add their work to the record the first one opened. That record stays joinable for the event's whole dispatch — browsers run microtasks between listeners, so it is finalized at the next task, not at a microtask — and is recorded no earlier, at the instant it settled. The same event dispatched again after that is a new interaction. A frame without an `event` (a test harness's `withInteraction`) is its own record and settles as it closes.
1189
+
- `name`, `target`, `at` — what the runtime described to `withInteraction` for the event's first frame (`at` the event's own `timeStamp` when it was given, else the dispatch); `inputDelayMs` — the browser's queueing from `at` to the first handler's entry, present when `at` predates it; `handlerMs` — the handlers themselves, the first one's entry to the last one's return.
1182
1190
- `writes` — root writes attributed to the frame: the handler's, and those of frames it opened (a navigation).
1183
1191
- `runs` and `created` — re-runs traced back to it, and computations _created_ in those runs or in its flushes (the "create 1,000 rows" work, which no `RerunEvent` describes); `runMs` sums the self-time of both.
1184
1192
- `holds` — the `HoldEvent`s its writes waited in; `navigations` — the `NavigationEvent`s performed under it. The same objects as in `history("hold")`/`history("navigation")`.
1185
-
- `settledMs` and `outcome`, once everything is through: `idle` (the handler wrote nothing — settles as the frame closes), `committed` (its writes went through in drains no transition held — settles at the end of the last such drain), `held` (at least one write waited in a transition — settles at the last hold's commit). A navigation under it must settle first.
1193
+
- `settledMs` and `outcome`, once everything is through: `idle` (the handlers wrote nothing — settles as the last frame closes, recorded at the next task for an event's frames), `committed` (its writes went through in drains no transition held — settles at the end of the last such drain), `held` (at least one write waited in a transition — settles at the last hold's commit). A navigation under it must settle first.
1186
1194
- `origin` — the frame object every downstream record carries as `interaction`; join by identity.
1187
1195
1188
1196
Runs are counted while the record is open; an async landing the interaction caused that arrives after its writes committed (a fetch behind a `Loading` boundary that showed its fallback) is attributed to it on the `RerunEvent` but is not the interaction's wait — the boundary answered.
0 commit comments