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 ? (