Skip to content

Handle page refreshes better with devtools open #202

Closed
@jakemac53

Description

@jakemac53

If you refresh the page with devtools open, then devtools no longer works. Worse, refreshing the page doesn't fix it, because the debug service is no longer running at all, and even when it does start up it will choose a different port.

A full page refresh can happen after initiating a hot restart (if the module structure changes), so its possible that just clicking hot restart in the devtools UI will cause this behavior.

I think the ideal scenario here would be to:

  • only shut down the dwds service if all clients disconnect, so if devtools is still open it will remain open
  • watch for refresh events and fire an IsolateExit event on the Isolate stream.
    • also the isolate field should be set to null, which means it needs to be mutable and will cause some refactoring
  • when an SSE connection opens, we should check if we already have a dwds instance for that application and create a new isolate for the page right away, instead of waiting for an alt+d.
    • this should also fire IsolateStart (and probably IsolateRunnable) events.

There is one edge case here which happens if you open up the same app in multiple tabs. We can recognize this if when starting the SSE connection we find an existing dwds instance that already has a valid isolate. We could just throw an unsupported error for now in that case, essentially that means you can only debug one version of the same app at a time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions