@remotion/studio-server: Fix AppleScript tab focus not triggering for studio#6864
Merged
JonnyBurger merged 1 commit intomainfrom Mar 18, 2026
Merged
@remotion/studio-server: Fix AppleScript tab focus not triggering for studio#6864JonnyBurger merged 1 commit intomainfrom
@remotion/studio-server: Fix AppleScript tab focus not triggering for studio#6864JonnyBurger merged 1 commit intomainfrom
Conversation
Two bugs prevented the AppleScript tab-reuse logic from ever running: 1. `browserFlag` defaults to `''` (empty string), but the guard checked `typeof browser !== 'string'`, which is false for `''`. Changed to `!browser` so both `undefined` and `''` are treated as "no specific browser requested". 2. `matchURL` used the full URL by default (e.g. `http://localhost:3000/my-comp`), so it would never match a tab already open on a different path. Now always matches by origin (`http://localhost:3000`), which works because the AppleScript uses `contains`. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@remotion/studio-server: Fix AppleScript tab focus not triggering for studio
Contributor
There was a problem hiding this comment.
The fix looks correct. Two changes:
-
Line 36:
!browsercorrectly handles bothundefinedand''(empty string default). The oldtypeof browser !== 'string'was always false sincetypeof '' === 'string', so AppleScript was never attempted. -
Line 87: Always using
normalizeURLToMatch(url)(origin only) works because the AppleScript usescontainsfor URL matching, so any tab on the same origin will be matched regardless of path.
Both fixes address the issues described in the PR description.
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
browserFlagdefaults to''which caused the AppleScript tab-reuse guard (typeof browser !== 'string') to always be false — AppleScript was never attempted. Fixed by using!browserinstead.matchURLused the full URL including path, so an existing tab on/my-compwouldn't match when opening/. Now always matches by origin, since the AppleScript usescontains.Test plan
npx remotion studiowith Chrome open — should focus existing tab instead of opening new one/dynamic-length)🤖 Generated with Claude Code