Skip to content

@remotion/studio-server: Fix AppleScript tab focus not triggering for studio#6864

Merged
JonnyBurger merged 1 commit intomainfrom
fix/applescript-tab-focus
Mar 18, 2026
Merged

@remotion/studio-server: Fix AppleScript tab focus not triggering for studio#6864
JonnyBurger merged 1 commit intomainfrom
fix/applescript-tab-focus

Conversation

@JonnyBurger
Copy link
Copy Markdown
Member

Summary

  • browserFlag defaults to '' which caused the AppleScript tab-reuse guard (typeof browser !== 'string') to always be false — AppleScript was never attempted. Fixed by using !browser instead.
  • matchURL used the full URL including path, so an existing tab on /my-comp wouldn't match when opening /. Now always matches by origin, since the AppleScript uses contains.

Test plan

  • Run npx remotion studio with Chrome open — should focus existing tab instead of opening new one
  • Verify it works when tab is on a different composition path (e.g. /dynamic-length)
  • Verify new tab is created when no matching tab exists

🤖 Generated with Claude Code

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>
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 18, 2026

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

Project Deployment Actions Updated (UTC)
bugs Ready Ready Preview, Comment Mar 18, 2026 10:14am
remotion Ready Ready Preview, Comment Mar 18, 2026 10:14am

Request Review

@JonnyBurger JonnyBurger changed the title Fix AppleScript tab focus not triggering for studio @remotion/studio-server: Fix AppleScript tab focus not triggering for studio Mar 18, 2026
Copy link
Copy Markdown
Contributor

@pullfrog pullfrog bot left a comment

Choose a reason for hiding this comment

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

The fix looks correct. Two changes:

  1. Line 36: !browser correctly handles both undefined and '' (empty string default). The old typeof browser !== 'string' was always false since typeof '' === 'string', so AppleScript was never attempted.

  2. Line 87: Always using normalizeURLToMatch(url) (origin only) works because the AppleScript uses contains for 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.

Pullfrog  | View workflow runpullfrog.com𝕏

@JonnyBurger JonnyBurger merged commit 4f05fc2 into main Mar 18, 2026
15 checks passed
@JonnyBurger JonnyBurger deleted the fix/applescript-tab-focus branch March 18, 2026 12:25
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.

1 participant