Skip to content

Event delegation shares the $$<type> expando with Solid, so handlers fire twice inside Octane roots #1882

Description

@dion04

Summary

Octane's event delegation stores handlers on DOM nodes under $$<type> keys ($$click, $$capture:click). Solid's event delegation uses the same node.$$click property. When a Solid-built widget is mounted inside an Octane root, each dispatcher calls the other's handlers. One native click then runs a handler twice.

This affects every Solid-based tool rendered inside an Octane tree, including @tanstack/query-devtools (via @octanejs/tanstack-query-devtools, #1881) and @tanstack/devtools (via @octanejs/tanstack-devtools).

Observed

In examples/hacker-news with <ReactQueryDevtools /> mounted inside QueryClientProvider:

  1. Devtools handlers fire twice. Clicking a query row in the docked panel never opens the details view. The row handler is the toggle setSelectedQueryHash(same ? null : hash), and it runs twice per click, so it selects and then immediately deselects. Picture-in-picture mode works because the panel is in a separate window whose document has no Octane root.
  2. Octane handlers fire twice. Once Solid has registered its document click listener, Octane's own onClick handlers also fire twice. Solid's handler walks up from the target and calls any function it finds at node.$$click, and that includes Octane's raw-function slots. Measured on the header <a>new</a> link: 2 calls per click.
  3. Octane's compiled handler bundles can throw in Solid's walk. $$click can also hold a HandlerBundle object ({ fn, args, … }). Solid calls handler.call(node, e) on whatever it finds there, which fails on an object.

Minimal probe, run in the page with any Solid widget mounted inside the Octane root #app:

const mk = (parent) => {
  const d = document.createElement('div');
  let n = 0;
  d.$$click = () => n++;
  parent.appendChild(d);
  d.click();
  d.remove();
  return n;
};
mk(document.body); // 1: only Solid's document listener
mk(document.querySelector('#app').firstElementChild); // 2: Solid + Octane root listener

Root cause

  • Runtime: eventSlot() builds key: '$$' + type (packages/octane/src/runtime.ts), and the dispatch walk reads node[type.bubbleKey] with bubbleKey: '$$' + name.
  • Compiler: compile.js emits the same '$$<event>' / '$$capture:<event>' slot keys.
  • Solid (solid-js/web delegateEvents/eventHandler) reads node['$$' + e.type] from a document listener.

The two namespaces are identical, so each library treats the other's stamps as its own.

Expected

A foreign library's $$click property must not run through Octane's dispatcher, and Octane's handler slots must not be visible to another library's delegation. One native click runs each handler once.

Proposed fix

Move Octane's delegated-handler slot keys to a namespace that no other framework uses (currently $$<type>; Solid uses $$, Svelte 5 __, Inferno $EV). The change goes in both the runtime and the compiler, with a regression test that mounts a foreign $$click stamp inside an Octane root and asserts that each handler fires exactly once.

Activity

  1. added a commit that references this issue on Oct 8, 2026
    d1e308b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions