From 8033094c4d34651149aee94d727b7a600cb80d8b Mon Sep 17 00:00:00 2001
From: Mistium <92952823+Mistium@users.noreply.github.com>
Date: Sat, 10 Oct 2026 00:15:47 +0100
Subject: [PATCH] Fix crashes from the October 9 error reports
- Treat Safari's "Cross-origin script load denied" as a chunk load failure,
so page imports blocked by a network filter retry and reload. Community
pages that still fail show a "could not load" screen with a working Try
again, and are not reported as crashes.
- Ask browsers not to machine-translate the editor and embed. The old
meta tag used value= instead of content=, and Edge's translator kept
crashing React with removeChild errors.
- DOMElementRenderer only removes its element if it still contains it.
- The sprite list no longer crashes when it mounts in the middle of a drag.
- Restore points save with a blank thumbnail when there is no renderer
(no WebGL), instead of failing and throwing from a leftover timer.
- The gamepad addon stops early when there is no renderer.
- A project that needs an extension MistWarp does not have shows a clear
load error naming the extension, instead of the crash screen. Embeds
no longer offer "Start a new project" inside the project page.
---
src/addons/addons/gamepad/userscript.js | 1 +
.../components/RouteErrorBoundary.jsx | 26 ++++--
src/community/translations/_sources.json | 14 ++-
src/community/translations/en.json | 4 +-
.../project-load-error/project-load-error.css | 2 +-
.../project-load-error/project-load-error.jsx | 86 ++++++++++++-------
src/containers/dom-element-renderer.jsx | 4 +-
src/containers/gui.jsx | 11 ++-
src/lib/api/restore-points.js | 15 +++-
src/lib/components/sortable-hoc.jsx | 2 +-
src/lib/lazy-with-retry.js | 42 ++++-----
src/lib/tw-translations/default-messages.json | 1 +
src/playground/embed.ejs | 4 +-
src/playground/index.ejs | 4 +-
.../components/dom-element-renderer.test.jsx | 22 +++++
.../components/project-load-error.test.jsx | 22 +++++
.../util/runtime-error-regressions.test.js | 3 +-
test/unit/util/sortable-hoc.test.jsx | 25 ++++++
18 files changed, 215 insertions(+), 73 deletions(-)
create mode 100644 test/unit/components/dom-element-renderer.test.jsx
create mode 100644 test/unit/util/sortable-hoc.test.jsx
diff --git a/src/addons/addons/gamepad/userscript.js b/src/addons/addons/gamepad/userscript.js
index 01aedc8a08d..9ab33ffb1d9 100644
--- a/src/addons/addons/gamepad/userscript.js
+++ b/src/addons/addons/gamepad/userscript.js
@@ -125,6 +125,7 @@ export default async function ({addon, console, msg}) {
}
const renderer = vm.runtime.renderer;
+ if (!renderer) return;
const stageWidth = () => vm.runtime.stageWidth;
const stageHeight = () => vm.runtime.stageHeight;
const canvas = renderer.canvas;
diff --git a/src/community/components/RouteErrorBoundary.jsx b/src/community/components/RouteErrorBoundary.jsx
index 53feebf0054..0060c9806e3 100644
--- a/src/community/components/RouteErrorBoundary.jsx
+++ b/src/community/components/RouteErrorBoundary.jsx
@@ -1,21 +1,24 @@
import PropTypes from 'prop-types';
import React from 'react';
import {Link} from 'react-router-dom';
-import {House, RotateCcw, TriangleAlert} from 'lucide-react';
+import {House, RotateCcw, TriangleAlert, WifiOff} from 'lucide-react';
import log from '../../lib/utils/log.js';
import {reportSiteError} from '../../lib/error-reporter.js';
+import {isChunkLoadError} from '../../lib/lazy-with-retry.js';
import {useCommunityIntl as useCommunityText} from '../i18n.jsx';
import Button from './ui/Button.jsx';
import EmptyState from './ui/EmptyState.jsx';
import styles from '../pages/InfoPage.module.css';
-const RouteErrorFallback = ({onRetry}) => {
+const RouteErrorFallback = ({offline, onRetry}) => {
const {text: communityText} = useCommunityText();
return (
);
};
RouteErrorFallback.propTypes = {
+ offline: PropTypes.bool,
onRetry: PropTypes.func.isRequired
};
@@ -61,6 +67,7 @@ class RouteErrorBoundary extends React.Component {
const stack = (error && error.stack) || String(error);
const componentStack = (errorInfo && errorInfo.componentStack) || '';
log.error(`Community page crashed at ${this.props.resetKey}: ${stack}\nComponent stack: ${componentStack}`);
+ if (isChunkLoadError(error)) return;
reportSiteError({
message: (error && error.message) || String(error),
stack: (error && error.stack) || '',
@@ -74,7 +81,14 @@ class RouteErrorBoundary extends React.Component {
}
render () {
- if (this.state.error) return ;
+ if (this.state.error) {
+ return (
+
+ );
+ }
return this.props.children;
}
}
diff --git a/src/community/translations/_sources.json b/src/community/translations/_sources.json
index 8130e8795c4..970782e6684 100644
--- a/src/community/translations/_sources.json
+++ b/src/community/translations/_sources.json
@@ -1067,7 +1067,7 @@
],
"Try again": [
"src/community/components/LanguagePicker.jsx:20",
- "src/community/components/RouteErrorBoundary.jsx:23",
+ "src/community/components/RouteErrorBoundary.jsx:26",
"src/community/components/ui/StatusMessage.jsx:26",
"src/community/pages/Notifications.jsx:418",
"src/community/pages/Random.jsx:56",
@@ -2309,14 +2309,20 @@
"This only reads your public Rotur info.": [
"src/community/components/RoturConsentModal.jsx:113"
],
+ "This page could not load.": [
+ "src/community/components/RouteErrorBoundary.jsx:20"
+ ],
"Something went wrong on this page.": [
- "src/community/components/RouteErrorBoundary.jsx:18"
+ "src/community/components/RouteErrorBoundary.jsx:21"
],
"Go to home": [
- "src/community/components/RouteErrorBoundary.jsx:27"
+ "src/community/components/RouteErrorBoundary.jsx:30"
+ ],
+ "Part of the site did not download. Check your connection and try again.": [
+ "src/community/components/RouteErrorBoundary.jsx:36"
],
"The problem has been reported. Try again, or head back to the home page.": [
- "src/community/components/RouteErrorBoundary.jsx:32"
+ "src/community/components/RouteErrorBoundary.jsx:37"
],
"Loading pageā¦": [
"src/community/components/RouteLoading.jsx:53"
diff --git a/src/community/translations/en.json b/src/community/translations/en.json
index ebee8fb3b1a..af41089abe1 100644
--- a/src/community/translations/en.json
+++ b/src/community/translations/en.json
@@ -2818,5 +2818,7 @@
"Buy this project to comment.": "Buy this project to comment.",
"Buy this project to react.": "Buy this project to react.",
"Remove from library, {value1} saves": "Remove from library, {value1} saves",
- "Save to library, {value1} saves": "Save to library, {value1} saves"
+ "Save to library, {value1} saves": "Save to library, {value1} saves",
+ "This page could not load.": "This page could not load.",
+ "Part of the site did not download. Check your connection and try again.": "Part of the site did not download. Check your connection and try again."
}
diff --git a/src/components/project-load-error/project-load-error.css b/src/components/project-load-error/project-load-error.css
index 789f48595da..b67b3167242 100644
--- a/src/components/project-load-error/project-load-error.css
+++ b/src/components/project-load-error/project-load-error.css
@@ -5,7 +5,7 @@
align-items: center;
justify-content: center;
width: 100%;
- min-height: 100%;
+ min-height: 100vh;
background: $ui-primary;
color: $text-primary;
}
diff --git a/src/components/project-load-error/project-load-error.jsx b/src/components/project-load-error/project-load-error.jsx
index cf40bd0217b..03da4cd7901 100644
--- a/src/components/project-load-error/project-load-error.jsx
+++ b/src/components/project-load-error/project-load-error.jsx
@@ -7,7 +7,13 @@ import styles from './project-load-error.css';
const newProjectHref = () => (process.env.ROUTING_STYLE === 'wildcard' ?
`${process.env.ROOT || '/'}editor` : 'editor.html');
-const ProjectLoadError = ({error, onNewProject, onOpenFile, onRetry}) => {
+export const unknownExtensionId = error => {
+ const match = /^Unknown extension: (.+)$/.exec(String((error && error.message) || error || ''));
+ return match ? match[1] : null;
+};
+
+const ProjectLoadError = ({error, isEmbedded, onNewProject, onOpenFile, onRetry}) => {
+ const missingExtension = unknownExtensionId(error);
const handleNewProject = useCallback(event => {
if (!onNewProject) return;
event.preventDefault();
@@ -26,37 +32,56 @@ const ProjectLoadError = ({error, onNewProject, onOpenFile, onRetry}) => {
id="mw.projectLoadError.title"
/>
-
-
-
- {error.message || String(error)}
-
-
+
+ ) : (
+
+
+
+
+ {error.message || String(error)}
+
+ )}
+
+ {missingExtension || !onRetry ? null : (
+
+ )}
{/* A link, so it works even if the editor never finished starting. */}
-
-
-
+ {isEmbedded ? null : (
+
+
+
+ )}
{onOpenFile ? (