Skip to content

🎥 Make videos programmatically with React

fix blank-page

Jonny Burger66396ad0352b
diff --git a/packages/studio/src/Studio.tsx b/packages/studio/src/Studio.tsx
index 058b743acc..c498ef5f65 100644
--- a/packages/studio/src/Studio.tsx
+++ b/packages/studio/src/Studio.tsx
@@ -17,10 +17,16 @@ export const Studio: React.FC<{
useLayoutEffect(() => {
window.remotion_isStudio = true;
Internals.enableSequenceStackTraces();
+
+ return () => {
+ window.remotion_isStudio = false;
+ };
}, []);
+
useLayoutEffect(() => {
injectCSS();
}, []);
+
return (
<Internals.RemotionRoot
numberOfAudioTags={window.remotion_numberOfAudioTags}
diff --git a/packages/studio/src/hot-middleware-client/process-update.ts b/packages/studio/src/hot-middleware-client/process-update.ts
index 93353e4524..3a62b52171 100644
--- a/packages/studio/src/hot-middleware-client/process-update.ts
+++ b/packages/studio/src/hot-middleware-client/process-update.ts
@@ -32,6 +32,13 @@ const applyOptions: AcceptOptions = {
'Ignored an update to unaccepted module ' +
(data.chain ?? []).join(' -> '),
);
+
+ // Case:
+ // 1. Import a CSS file with a bad filename in Root.tsx
+ // 2. Fix the import and save it
+ if (!window.remotion_isStudio) {
+ reloadUrl();
+ }
},
onDeclined(data) {
console.warn(
diff --git a/packages/studio/src/previewEntry.tsx b/packages/studio/src/previewEntry.tsx
index 294a64796a..3477e4e035 100644
--- a/packages/studio/src/previewEntry.tsx
+++ b/packages/studio/src/previewEntry.tsx
@@ -45,7 +45,7 @@ renderToDOM(<NoRegisterRoot />);
Internals.waitForRoot((NewRoot) => {
renderToDOM(<Studio readOnly={false} rootComponent={NewRoot} />);
- startErrorOverlay();
});
+startErrorOverlay();
enableHotMiddleware();