pxt-microbit
pxt-microbit copied to clipboard
Timing-related page load issue that leaves UI in broken state (simulator driver init)
Describe the bug We've spotted what seems to be a load/initialisation timing issue that can leave MakeCode UI in a broken state.
To Reproduce Steps to reproduce the behavior:
- Open a new incognito browser
- Open dev tools and set the network tab data rate to "Slow 4G" (this significantly improves the chance of reproduction)
- Load https://makecode.microbit.org/#editor (slowly!)
- Most of the time you should see the UI in the bad state shown below with the following logged error:
main.js:1 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'preload')
at me.internalLoadHeaderAsync (main.js:1:600490)
at me.loadHeaderAsync (main.js:1:600276)
at async me.createProjectAsync (main.js:1:625874)
The error is here in the code.
If you need to try again to reproduce then close all incognito browser windows to start with no cache.
We originally saw this issue in micro:bit classroom in the embedded iframe scenario, where you get the same logged error but MakeCode recovers after showing this message:
In the non-iframe scenario above MakeCode does not recover and the user has to reload the page and hope they avoid the issue next time.
Expected behavior MakeCode loads as normal.
Screenshots
micro:bit version (please complete the following information):
N/A
Desktop (please complete the following information):
- OS: Mac
- Browser Chrome
- Version 132.0.6834.160 (Official Build) (arm64)
CC @microbit-grace @microbit-robert