Skip to content

Events are silently dropped after a bun --hot reload #37

Closed

Description

@Lugribossk

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!

Activity

  1. added a commit that references this issue on Sep 14, 2026
    89b6799
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