[DO NOT MERGE] Use noproject flag#14
Open
microbit-matt-hillsdon wants to merge 2 commits intomainfrom
Open
Conversation
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.
Deploying makecode-embed with
|
| Latest commit: |
2eceb04
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ff8feb03.makecode-embed.pages.dev |
| Branch Preview URL: | https://noproject.makecode-embed.pages.dev |
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR for visibility, no intent to merge.