Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timing-related page load issue that leaves UI in broken state (simulator driver init) #6081

Open
microbit-matt-hillsdon opened this issue Feb 6, 2025 · 5 comments

Comments

@microbit-matt-hillsdon
Copy link
Contributor

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:

  1. Open a new incognito browser
  2. Open dev tools and set the network tab data rate to "Slow 4G" (this significantly improves the chance of reproduction)
  3. Load https://makecode.microbit.org/#editor (slowly!)
  4. 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:

Image

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

Image

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

@abchatra
Copy link
Collaborator

I can't reproduce the problem with slow 4g setting in Edge.

@microbit-matt-hillsdon
Copy link
Contributor Author

I can't reproduce the problem with slow 4g setting in Edge.

@abchatra please check

I just tried on a fresh Edge install on Mac (so with an empty cache) and reproduced it first time with Slow 4G enabled.

It might take a few attempts, be sure to use a new incognito window each time.

@abchatra
Copy link
Collaborator

I was trying windows. Will try in Mac and see.

@microbit-matt-hillsdon
Copy link
Contributor Author

Doubt it's a platform thing but maybe the different hardware will get you different timings so you trip over the issue.

@microbit-matt-hillsdon
Copy link
Contributor Author

I tried Windows and found it harder to reproduce but it does happen for me reliably if you drop down to the (very slow!) "3G" mode. I suspect it's just about forcing the right sequence of events.

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

No branches or pull requests

2 participants