Skip to content

Conversation

@microbit-matt-hillsdon
Copy link
Contributor

@microbit-matt-hillsdon microbit-matt-hillsdon commented Jan 20, 2026

See microbit-foundation/python-editor-v3#89

Ultimately this needs a fix in DAPLink to clear the queue when the host reconnects but that won't have much impact on existing devices.

If this gets merged then we should also merge it into the apps branch and remove the PAUSED state that more explicitly models the workaround there.

Repro steps via the demo:

  • Disable the retries in this PR (or disable remove the beforeunload/visibilitychanged workarounds on main)
  • Write a MakeCode project that spams serial
  • Connect via the demo
  • Start serial via the button
  • Reload the page
  • Connect and see it fail ~50% of the time

Now we have this fix, I think if apps want visibility based disconnection they should do it themselves. The beforeunload stuff is also perhaps unnecessary and unreliable.

Plan to integrate this / behaviour changes

Because the disconnect on tab visibility has been a long-standing workaround, I think we should move this fix to the apps branch and integrate it with the changes there that introduce a PAUSED state (these are breaking and targetting 1.0). These disconnects play an important role in letting folks use multiple micro:bit apps. MakeCode will disconnect from USB in a similar way (though I think not if it's seen serial data). But I'll discuss this with product folks too.

From a library point of view, transitioning to PAUSED can then be an optional feature supported uniformly across USB and Bluetooth. Then when we upgrade the Python Editor we can just not clear the serial console on transitions to PAUSED.

See microbit-foundation/python-editor-v3#89

Ultimately this needs a fix in DAPLink to clear the queue on reset but that
won't have much impact on existing devices.
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 21, 2026

Deploying microbit-connection with  Cloudflare Pages  Cloudflare Pages

Latest commit: a728ae7
Status: ✅  Deploy successful!
Preview URL: https://d9dbb298.microbit-connection.pages.dev
Branch Preview URL: https://bad-response-workaround.microbit-connection.pages.dev

View logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants