Skip to content

[DO NOT MERGE] Use noproject flag#14

Open
microbit-matt-hillsdon wants to merge 2 commits intomainfrom
noproject
Open

[DO NOT MERGE] Use noproject flag#14
microbit-matt-hillsdon wants to merge 2 commits intomainfrom
noproject

Conversation

@microbit-matt-hillsdon
Copy link
Copy Markdown
Contributor

PR for visibility, no intent to merge.

On slow networks, MakeCode's DOMContentLoaded chain calls
loadHeaderAsync/newProject before componentDidMount finishes setting up
simulator.driver, producing "Cannot read properties of undefined (reading
'preload')" and a broken UI on the embedding page.

Add noproject=1 alongside controller, and respond to the resulting 'newproject'
host message by importing initialProjects()[0]. The parent-driven import
arrives after componentDidMount has completed, dodging the race. This is the
same flow as MakeCode's initialization, but later and under our control.

Trades the race for a weird interim state where there's no project but the
editor is rendered. This looks janky, but is acceptable for the CreateAI
scenario where MakeCode isn't initially visible.

Remove once microsoft/pxt commit 50486a9 (fixing microsoft/pxt-microbit#6081)
is live in deployed MakeCode.

As it's not the best option for all consumers we're going to produce a one off
-noproject release from this branch to tide us over until the MakeCode release.

As an aside, the newproject host message currently arrives without a 'type'
field (MakeCode app.tsx:6519, unlike other postHostMessageAsync call sites), so
detect it by action and accept either shape so we keep working if upstream is
fixed.
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying makecode-embed with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2eceb04
Status: ✅  Deploy successful!
Preview URL: https://ff8feb03.makecode-embed.pages.dev
Branch Preview URL: https://noproject.makecode-embed.pages.dev

View logs

microbit-matt-hillsdon pushed a commit to microbit-foundation/ml-trainer that referenced this pull request May 8, 2026
Note beta MakeCode was only ever used by the pre-release app, not the web version.

We switched to MakeCode beta for our app testing because we needed microsoft/pxt#11196 as iframe+tablet seems to make it much easier to reproduce microsoft/pxt-microbit#6081 to the point where we felt it was unusable.

The temporary branch of makecode-embed works around the problem differently by using the noproject flag (like skillsmap seems to).

As this will resolve itself in this summer's MakeCode release we're not going to merge that change in makecode-embed — if MakeCode is visible at init time there's a notable visual glitch where the empty editor is rendered. Fortunately this does not apply to CreateAI.

makecode-embed change for reference: microbit-foundation/makecode-embed#14
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.

1 participant