microsoft / pxt-microbit

A Blocks / JavaScript code editor for the micro:bit built on Microsoft MakeCode
https://makecode.microbit.org
Other
710 stars 589 forks source link

WebUSB disconnect gets the website into inconsistent state #5893

Open abchatra opened 2 weeks ago

abchatra commented 2 weeks ago

To Reproduce Steps to reproduce the behavior:

  1. Connect webusb to microbit
  2. Click on '...' in download dialog and click disconnect
  3. Try connect again.
  4. See error
abchatra commented 2 weeks ago

May be easy fix is to revert to the original behavior of asking user to disconnect in the Chrome UI.

jwunderl commented 2 weeks ago

The error hits here, failing to open device when reconnecting https://github.com/microsoft/pxt/blob/ca77f84310df2b70973b9ef65715c039b204cd70/pxtlib/webusb.ts#L464 -- refreshing the page, or disconnecting microbit & reconnecting as the modal instructs both resolve the issue. For now we're punting this problem from the release as it's not a regression, disconnect is rarely used (especially w/ regards to immediately reconnecting), and we'd just be swapping out modal with instructions for more work on the user side + a little chrome warning to refresh that they'd likely end up ignoring as well.