Skip to content

Commit

Permalink
Merge pull request #1387 from remotion-dev/throw-if-register-root-is-…
Browse files Browse the repository at this point in the history
…undefined
  • Loading branch information
JonnyBurger committed Oct 10, 2022
2 parents 40a3704 + e2acea5 commit 14de26c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/core/src/register-root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ let Root: React.FC | null = null;
let listeners: ((comp: React.FC) => void)[] = [];

export const registerRoot = (comp: React.FC) => {
if (!comp) {
throw new Error(
`You must pass a React component to registerRoot(), but ${JSON.stringify(
comp
)} was passed.`
);
}

if (Root) {
throw new Error('registerRoot() was called more than once.');
}
Expand Down

1 comment on commit 14de26c

@vercel
Copy link

@vercel vercel bot commented on 14de26c Oct 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.