Skip to content

@remotion/studio: Reload Studio when config changes#9017

Closed
JonnyBurger wants to merge 1 commit into
mainfrom
codex/studio-config-reload
Closed

@remotion/studio: Reload Studio when config changes#9017
JonnyBurger wants to merge 1 commit into
mainfrom
codex/studio-config-reload

Conversation

@JonnyBurger

Copy link
Copy Markdown
Member

Summary

  • Reload the loaded Remotion config file when it changes, reset previously applied config options, and trigger a Studio page reload.
  • Inject Studio runtime config through generated HTML and read it via explicit Studio helpers instead of relying on process.env in Studio UI code.
  • Add reset coverage for config options that need manual cleanup before reloading.

Test plan

  • bun run build
  • bun run stylecheck
  • bun test packages/cli/src/test/config-reset.test.ts

Closes #9011

Public dir hot-reload remains tracked separately in #9015.

@vercel

vercel Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bugs Ready Ready Preview, Comment Jul 11, 2026 11:33am
remotion Ready Ready Preview, Comment Jul 11, 2026 11:33am

Request Review

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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-changed event-source event.
  • Add resetConfigOptions() and per-option reset helpers so a reload starts from defaults rather than accumulating previous values.
  • Inject StudioRuntimeConfig into generated HTML and read it from explicit helpers in Studio UI code, removing the process.env dependency for ASK_AI_ENABLED, KEYBOARD_SHORTCUTS_ENABLED, INTERACTIVITY_ENABLED, MAX_TIMELINE_TRACKS, BUFFER_STATE_DELAY_IN_MILLISECONDS, and EXPERIMENTAL_CLIENT_SIDE_RENDERING_ENABLED.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

resetOption(enableCrossSiteIsolationOption, false);
resetOption(imageSequencePatternOption, null);
resetOption(darkModeOption, false);
resetOption(askAIOption, false);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ 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();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ 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 => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ℹ️ 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.

@JonnyBurger

Copy link
Copy Markdown
Member Author

Superseded by stacked PRs #9022 and #9024.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Config file changes should reload

1 participant