Skip to content

Dev server sends duplicate clientNavigated inspector events on successful SetUrl #32080

Closed

Description

@robobun

What is the problem?

The HMR socket's SetUrl handler notifies the inspector's BunFrontendDevServer.clientNavigated twice for a successful navigation to a new route bundle:

  1. Inline, right after route_to_bundle_index_slow, with routeBundleId set to the found index (or -1).
  2. Again via notify_inspector_client_navigation(pattern, Some(rbi)) after SetUrlResponse is sent.

Both events carry the same connection id, pattern, and route bundle id. The failed-lookup path correctly sends a single event with routeBundleId: -1, and the same-route early return also sends one.

Code: src/runtime/bake/DevServer/HmrSocket.rs (SetUrl arm and the notify_inspector_client_navigation helper). The .zig reference (src/runtime/bake/DevServer/HmrSocket.zig) has the identical structure, and both calls date to the original inspector support in 570e6b7 (#19340), so this is long-standing shipped behavior that the Rust port reproduced faithfully.

What is the expected behavior?

Presumably one clientNavigated event per navigation, unless the duplicate is intentional (for example, an attempt event followed by a confirmation after SetUrlResponse). If the duplication is removed, the failure path's single -1 event should be preserved.

Surfaced during review of #32076, which is a behavior-preserving refactor and deliberately does not change this.

Activity

  1. robobun commented on Jun 10, 2026

    @robobun
    CollaboratorAuthor

    ✅ Reproduced: one SetUrl over /_bun/hmr emitted two identical BunFrontendDevServer.clientNavigated events; fixed in #32081 (rebased on #32076).
    The PR is ready for review: the new test passes on every CI lane; the remaining CI red is unrelated runner flake (Docker daemon down for S3 tests, PTY timeouts), not the diff.

  2. added a commit that references this issue on Jun 11, 2026
    f8723b1
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