Skip to content

🎥 Make videos programmatically with React

Fix unhighlighted source flash in Studio

Jonny Burger7d3b5db91b1d
diff --git a/packages/studio/src/components/LazySyntaxHighlightedSource.tsx b/packages/studio/src/components/LazySyntaxHighlightedSource.tsx
index 91d294de04..e587d8d5cd 100644
--- a/packages/studio/src/components/LazySyntaxHighlightedSource.tsx
+++ b/packages/studio/src/components/LazySyntaxHighlightedSource.tsx
@@ -2,11 +2,18 @@ import React, {lazy, Suspense} from 'react';
const SyntaxHighlightedSource = lazy(() => import('./SyntaxHighlightedSource'));
+const fallbackStyle: React.CSSProperties = {
+ visibility: 'hidden',
+ fontFamily: 'inherit',
+ fontSize: 'inherit',
+ lineHeight: 'inherit',
+};
+
export const LazySyntaxHighlightedSource: React.FC<{
readonly source: string;
}> = ({source}) => {
return (
- <Suspense fallback={source}>
+ <Suspense fallback={<span style={fallbackStyle}>{source}</span>}>
<SyntaxHighlightedSource source={source} />
</Suspense>
);