Skip to content

🎥 Make videos programmatically with React

`remotion`: Hide checkerboard while resolving Suspense (#10600)

Jonny Burgerab3abcf2a931
diff --git a/packages/core/src/loading-indicator.tsx b/packages/core/src/loading-indicator.tsx
index cda9f58728..f613a40106 100644
--- a/packages/core/src/loading-indicator.tsx
+++ b/packages/core/src/loading-indicator.tsx
@@ -15,6 +15,15 @@ const label: React.CSSProperties = {
const container: React.CSSProperties = {
justifyContent: 'center',
alignItems: 'center',
+ backgroundColor: '#1f2428',
+};
+
+const content: React.CSSProperties = {
+ display: 'flex',
+ flexDirection: 'column',
+ alignItems: 'center',
+ animation: 'anim 2s',
+ animationFillMode: 'forwards',
};
export const Loading: React.FC = () => {
@@ -29,26 +38,24 @@ export const Loading: React.FC = () => {
opacity: 1
}
}
- #remotion-comp-loading {
- animation: anim 2s;
- animation-fill-mode: forwards;
- }
`}</style>
- <svg
- width={ICON_SIZE}
- height={ICON_SIZE}
- viewBox="-100 -100 400 400"
- style={rotate}
- >
- <path
- fill="#555"
- stroke="#555"
- strokeWidth="100"
- strokeLinejoin="round"
- d="M 2 172 a 196 100 0 0 0 195 5 A 196 240 0 0 0 100 2.259 A 196 240 0 0 0 2 172 z"
- />
- </svg>
- <p style={label}>Resolving {'<Suspense>'}...</p>
+ <div id="remotion-comp-loading-content" style={content}>
+ <svg
+ width={ICON_SIZE}
+ height={ICON_SIZE}
+ viewBox="-100 -100 400 400"
+ style={rotate}
+ >
+ <path
+ fill="#555"
+ stroke="#555"
+ strokeWidth="100"
+ strokeLinejoin="round"
+ d="M 2 172 a 196 100 0 0 0 195 5 A 196 240 0 0 0 100 2.259 A 196 240 0 0 0 2 172 z"
+ />
+ </svg>
+ <p style={label}>Resolving {'<Suspense>'}...</p>
+ </div>
</AbsoluteFillElement>
);
};
diff --git a/packages/core/src/test/sequence-register-once.test.tsx b/packages/core/src/test/sequence-register-once.test.tsx
index 84613385bd..5b0499c90a 100644
--- a/packages/core/src/test/sequence-register-once.test.tsx
+++ b/packages/core/src/test/sequence-register-once.test.tsx
@@ -1485,7 +1485,16 @@ test('Loading indicator does not register an interactive sequence', () => {
);
expect(getByText('Resolving <Suspense>...')).toBeTruthy();
- expect(container.querySelector('#remotion-comp-loading')).toBeTruthy();
+ const loadingIndicator = container.querySelector<HTMLDivElement>(
+ '#remotion-comp-loading',
+ );
+ expect(loadingIndicator).toBeTruthy();
+ expect(loadingIndicator?.style.backgroundColor).toBe('#1f2428');
+ expect(loadingIndicator?.style.animation).toBe('');
+ const loadingContent = container.querySelector<HTMLDivElement>(
+ '#remotion-comp-loading-content',
+ );
+ expect(loadingContent?.style.animation).toBe('anim 2s');
expect(registeredSequences).toHaveLength(0);
});