Skip to content

Update scratch version to 13#1389

Open
abcampo-iry wants to merge 5 commits intomainfrom
issues/1230-update-scratch-version-13
Open

Update scratch version to 13#1389
abcampo-iry wants to merge 5 commits intomainfrom
issues/1230-update-scratch-version-13

Conversation

@abcampo-iry
Copy link
Contributor

@abcampo-iry abcampo-iry commented Mar 17, 2026

Updated Scratch to version 13 and update to react-redux 8 is needed since it's a required peer dependency.
Also for react-redux 8 we need redux as a peer dependency too, so we need to provide it ourselves.

Updating the version didn't change the HTML preview behavior directly, but it changed the timing enough to expose an existing race in the HTML runner internal-link flow.

Test change explanation:

When an internal link was clicked, the app updated previewFile and triggered a rerun in the same tick.
In CI runs, because it can be slower, the rerun could happen before React had actually applied the new previewFile, so the iframe sometimes re-rendered new.html again instead of index.html.

What changed:

  • In externalLinkHelper internal-link handling now only updates previewFile. In HtmlRunner, the rerun is deferred until after previewFile has actually changed, via reloadAfterPreviewChange.
  • Also same-file reloads are now handled explicitly, so if the requested preview file is already the current one, we rerun immediately instead of leaving a pending reload behind.
  • In spec-html.cy, getIframeBody() doesn't use .then(cy.wrap), so Cypress keeps re-querying the live iframe body instead of holding a stale body element across iframe navigation.
  • The assertion in allows internal links was simplified to getIframeBody().should("contain.text", "hello world"), which matches the user-visible behavior and avoids depending on a specific node during reload.

Now the assertion is less coupled to the exact DOM shape and retries against the current iframe document, which is what we want for navigation/reload behavior.

There was also an issue exposed in WebComponentLoader after the dependency update.
loadRemix was being kept as derived state through an effect, and after the upgrade that became unstable.
Now loadRemix is derived directly from user and remixLoadFailed, which removes the extra state sync and avoids the loader getting stuck.

In WebComponentLoader.test, the mocked changeLanguage now resolves instead of returning a never-ending promise, which matches the real behavior better and avoids the test hanging.

@abcampo-iry abcampo-iry temporarily deployed to previews/1389/merge March 17, 2026 10:04 — with GitHub Actions Inactive
@abcampo-iry abcampo-iry force-pushed the issues/1230-update-scratch-version-13 branch from 6b7f829 to dc434e2 Compare March 17, 2026 11:35
@abcampo-iry abcampo-iry temporarily deployed to previews/1389/merge March 17, 2026 11:35 — with GitHub Actions Inactive
@abcampo-iry abcampo-iry temporarily deployed to previews/1389/merge March 17, 2026 11:49 — with GitHub Actions Inactive
@abcampo-iry abcampo-iry force-pushed the issues/1230-update-scratch-version-13 branch from dceae60 to 367a167 Compare March 17, 2026 12:19
@abcampo-iry abcampo-iry temporarily deployed to previews/1389/merge March 17, 2026 12:20 — with GitHub Actions Inactive
@abcampo-iry abcampo-iry force-pushed the issues/1230-update-scratch-version-13 branch from 367a167 to 3192902 Compare March 17, 2026 12:35
@abcampo-iry abcampo-iry temporarily deployed to previews/1389/merge March 17, 2026 12:35 — with GitHub Actions Inactive
@abcampo-iry abcampo-iry force-pushed the issues/1230-update-scratch-version-13 branch from 3192902 to 2269a8d Compare March 17, 2026 14:16
@abcampo-iry abcampo-iry temporarily deployed to previews/1389/merge March 17, 2026 14:16 — with GitHub Actions Inactive
@abcampo-iry abcampo-iry force-pushed the issues/1230-update-scratch-version-13 branch from 2269a8d to 1b64edb Compare March 17, 2026 14:32
@abcampo-iry abcampo-iry temporarily deployed to previews/1389/merge March 17, 2026 14:33 — with GitHub Actions Inactive
@abcampo-iry abcampo-iry force-pushed the issues/1230-update-scratch-version-13 branch from 1b64edb to 9d575a9 Compare March 17, 2026 14:55
@abcampo-iry abcampo-iry temporarily deployed to previews/1389/merge March 17, 2026 14:56 — with GitHub Actions Inactive
@abcampo-iry abcampo-iry marked this pull request as ready for review March 17, 2026 15:15
Copilot AI review requested due to automatic review settings March 17, 2026 15:15
@abcampo-iry abcampo-iry changed the title Issues/1230 update scratch version 13 Update scratch version to 13 Mar 17, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the project’s Scratch/React-Redux dependency stack and adjusts HTML runner internal-link handling to avoid a race condition exposed by the Scratch v13 timing changes.

Changes:

  • Bump @scratch/scratch-gui to v13 and upgrade to react-redux v8, adding redux as an explicit dependency.
  • Fix HTML runner internal-link flow by deferring reruns until after previewFile state changes.
  • Make Cypress HTML iframe assertions resilient to iframe navigation by re-querying the live body.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
yarn.lock Lockfile updates reflecting Scratch v13, React-Redux v8, and new transitive dependency graph.
package.json Updates @scratch/scratch-gui and react-redux, adds redux peer dependency.
src/utils/externalLinkHelper.js Removes immediate rerun dispatch for internal-link handling (now rerun is coordinated by HtmlRunner).
src/components/Editor/Runners/HtmlRunner/HtmlRunner.jsx Adds reloadAfterPreviewChange deferral to avoid internal-link race when switching preview files.
cypress/e2e/spec-html.cy.js Updates iframe body helper and assertion to avoid stale DOM references across iframe reload/navigation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@abcampo-iry abcampo-iry marked this pull request as draft March 17, 2026 15:37
@abcampo-iry abcampo-iry marked this pull request as ready for review March 17, 2026 17:43
@abcampo-iry abcampo-iry temporarily deployed to previews/1389/merge March 18, 2026 08:45 — with GitHub Actions Inactive
@abcampo-iry abcampo-iry force-pushed the issues/1230-update-scratch-version-13 branch from 54d7563 to 9b82f56 Compare March 18, 2026 09:38
@abcampo-iry abcampo-iry temporarily deployed to previews/1389/merge March 18, 2026 09:39 — with GitHub Actions Inactive
@abcampo-iry abcampo-iry force-pushed the issues/1230-update-scratch-version-13 branch from 9b82f56 to 7f9e18d Compare March 18, 2026 10:05
@abcampo-iry abcampo-iry temporarily deployed to previews/1389/merge March 18, 2026 10:05 — with GitHub Actions Inactive
@abcampo-iry abcampo-iry temporarily deployed to previews/1389/merge March 18, 2026 10:18 — with GitHub Actions Inactive
@abcampo-iry abcampo-iry temporarily deployed to previews/1389/merge March 18, 2026 10:38 — with GitHub Actions Inactive
@abcampo-iry abcampo-iry temporarily deployed to previews/1389/merge March 18, 2026 10:46 — with GitHub Actions Inactive
@abcampo-iry abcampo-iry force-pushed the issues/1230-update-scratch-version-13 branch from dc9633e to d125633 Compare March 18, 2026 11:51
@abcampo-iry abcampo-iry force-pushed the issues/1230-update-scratch-version-13 branch from d125633 to 84a4a91 Compare March 18, 2026 11:52
@abcampo-iry abcampo-iry temporarily deployed to previews/1389/merge March 18, 2026 11:52 — with GitHub Actions Inactive
internal HTML links now defer triggerCodeRun() until after previewFile changes,
instead of dispatching immediately while React state is still pointing
at the old page.

That is why externalLinkHelper stopped dispatching triggerCodeRun,
and HtmlRunner picked up the “wait for preview change, then rerun” flow.
This matters because without it the iframe can rerun the wrong file after clicking an internal link.
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.

2 participants