@remotion/studio: Reload Studio when config changes#9017
Conversation
There was a problem hiding this comment.
Important
Two correctness issues need attention before merging: askAIOption is reset to the wrong default, and a failed config reload leaves the Studio running with reset defaults.
Reviewed changes — Add config-file watching to studio so the Studio reloads when remotion.config.* changes, reset all mutable config options before reloading, and replace process.env plumbing for Studio UI flags with values injected into window.remotion_studioConfig.
- Watch the loaded config file and trigger a page reload via a new
config-file-changedevent-source event. - Add
resetConfigOptions()and per-option reset helpers so a reload starts from defaults rather than accumulating previous values. - Inject
StudioRuntimeConfiginto generated HTML and read it from explicit helpers in Studio UI code, removing theprocess.envdependency forASK_AI_ENABLED,KEYBOARD_SHORTCUTS_ENABLED,INTERACTIVITY_ENABLED,MAX_TIMELINE_TRACKS,BUFFER_STATE_DELAY_IN_MILLISECONDS, andEXPERIMENTAL_CLIENT_SIDE_RENDERING_ENABLED.
Kimi K2 (free via Pullfrog for OSS) | 𝕏
| resetOption(enableCrossSiteIsolationOption, false); | ||
| resetOption(imageSequencePatternOption, null); | ||
| resetOption(darkModeOption, false); | ||
| resetOption(askAIOption, false); |
There was a problem hiding this comment.
askAIOption defaults to enabled (true), but this resets it to false. After a config reload, the Ask AI feature will be disabled unless the config file explicitly calls Config.setAskAIEnabled(true) again.
Change false to true to match the default.
|
|
||
| isReloadingConfig = true; | ||
| try { | ||
| ConfigInternals.resetConfigOptions(); |
There was a problem hiding this comment.
loadConfig() can throw if the config file has a syntax error. When that happens, resetConfigOptions() has already run, so the Studio continues with reset defaults and the failure is not logged.
Consider catching the error, logging it, and deciding whether to keep the reset state or restore the previous config.
| return specifiedMetadata; | ||
| }; | ||
|
|
||
| export const resetMetadata = (): void => { |
There was a problem hiding this comment.
ℹ️ specifiedMetadata is typed as Record<string, string>, but this resets it to undefined with a cast. getMetadata() will then return undefined at runtime despite its type.
Consider typing specifiedMetadata as Record<string, string> | undefined and resetting to undefined without the cast, or reset to {} if an empty record is the intended default.

Summary
process.envin Studio UI code.Test plan
bun run buildbun run stylecheckbun test packages/cli/src/test/config-reset.test.tsCloses #9011
Public dir hot-reload remains tracked separately in #9015.