Run an app with bun --hot, save any source file so React remounts, then click anything. No event handler fires.
Claude tells me:
createRenderer() constructs the native renderer once with a closure that calls handleGpuixEvent, and the renderer survives reloads via the globalThis render-host slot. But containersByRenderer in reconciler/event-registry.js is a module-level WeakMap, and bun --hot re-evaluates the whole module graph on reload.
So after a reload:
- the remounted root registers its handlers via attachRoot in the new module instance's WeakMap,
- the old root's unmount empties the old instance's WeakMap,
- the native event closure still dispatches into the old instance → containersByRenderer.get(renderer) returns undefined → every event returns silently.
And thank you for the quick fixes to the other issues I reported!
Run an app with
bun --hot, save any source file so React remounts, then click anything. No event handler fires.Claude tells me:
createRenderer() constructs the native renderer once with a closure that calls handleGpuixEvent, and the renderer survives reloads via the globalThis render-host slot. But containersByRenderer in reconciler/event-registry.js is a module-level WeakMap, and bun --hot re-evaluates the whole module graph on reload.
So after a reload:
And thank you for the quick fixes to the other issues I reported!