@remotion/studio-server: Cache AST node paths to survive stale source maps#6942
Merged
JonnyBurger merged 2 commits intomainfrom Mar 31, 2026
Merged
@remotion/studio-server: Cache AST node paths to survive stale source maps#6942JonnyBurger merged 2 commits intomainfrom
@remotion/studio-server: Cache AST node paths to survive stale source maps#6942JonnyBurger merged 2 commits intomainfrom
Conversation
…ce maps When the studio modifies a file and suppresses the webpack rebuild, the source map becomes stale. If prettier then reformats the file (e.g. wrapping a return in parentheses), JSX tags shift to different lines. On reload, the stale source map still resolves to the old line number, causing subscribe-to-sequence-props to fail. This adds a server-side cache mapping (fileName, line, column) → AST nodePath. On the first successful subscription, the resolved nodePath is cached. Subsequent requests with the same stale coordinates reuse the cached nodePath (verified against the current AST). The cache is cleared when webpack rebuilds via compiler.hooks.done, at which point source maps are fresh and line-based lookup works again. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Reviewed PR #6942 — no actionable issues found. The cache-and-verify pattern is correct: cached Task list (6/6 completed)
|
Contributor
The `handleRequest` handler wraps all API responses in `{success, data}`,
so test assertions need to access `result.data.canUpdate` instead of
`result.canUpdate`.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
(fileName, line, column) → AST nodePathto handle stale source maps after suppressed webpack rebuildsreturnin parentheses), JSX tags shift lines. The stale source map still resolves to the old line, but the cached nodePath remains valid since the AST structure is unchangedcompiler.hooks.donewhen webpack rebuilds and source maps become fresh againProblem
On reload, the stale source map still resolves to line 22, but
lineColumnToNodePath(ast, 22)finds nothing →subscribe-to-sequence-propsfails.Solution
(file, line, col) → nodePathnodePath(verified against current AST)Test plan
packages/example/e2e/node-path-cache.test.mtsthat verifies the cache handles line shifts🤖 Generated with Claude Code