From ce79d3cd95078e03a94fa9c56125e2a60d56ff17 Mon Sep 17 00:00:00 2001 From: Elliot Date: Wed, 14 Sep 2022 08:11:42 -0400 Subject: [PATCH] Fix ui render call, improve error message (#294) --- theatre/core/src/projects/Project.ts | 3 ++- theatre/studio/src/Studio.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/theatre/core/src/projects/Project.ts b/theatre/core/src/projects/Project.ts index 3013c6d..770b836 100644 --- a/theatre/core/src/projects/Project.ts +++ b/theatre/core/src/projects/Project.ts @@ -120,7 +120,8 @@ export default class Project { `while you are using @theatre/core along with @theatre/studio. But since @theatre/studio ` + `is not loaded, the state of project "${id}" will be empty.\n\n` + `To fix this, you need to add @theatre/studio into the bundle and export ` + - `the project's state. Learn how to do that at https://docs.theatrejs.com/in-depth/#exporting`, + `the project's state. Learn how to do that at https://docs.theatrejs.com/in-depth/#exporting\n` + + `If you are using a framework like Next.js, this error may be caused by running Theatre on the server side.`, ) } }, 1000) diff --git a/theatre/studio/src/Studio.ts b/theatre/studio/src/Studio.ts index 088e747..42f991f 100644 --- a/theatre/studio/src/Studio.ts +++ b/theatre/studio/src/Studio.ts @@ -148,7 +148,7 @@ export class Studio { this._initializedDeferred.resolve() - if (process.env.NODE_ENV !== 'test') { + if (process.env.NODE_ENV !== 'test' && this.ui) { this.ui.render() checkForUpdates() }