Skip to content

Commit

Permalink
Debugger: j opens debugger on most recently connected target (faceb…
Browse files Browse the repository at this point in the history
…ook#45060)

Summary:
Pull Request resolved: facebook#45060

Currently, `j`, (i.e., `/open-debugger` with no parameters), connects the "first available" target, which in practice is the first page of the first connected device still connected.

In the absence of a target selection UI, a better guess at user intent is to use the *latest* target (most recently added page of most recently connected device).

Also slightly reduces CLI noise by not claiming that we're launching a debugger when there's no target, and not qualifying which target when there's only one.

Changelog:
[General][Changed] Debugger: `j` opens most recent (not first) target.

Reviewed By: huntie

Differential Revision: D58736151

fbshipit-source-id: 3d106a1fa958f9e5c91b16e04075609e1abf6e97
  • Loading branch information
robhogan authored and facebook-github-bot committed Jun 19, 2024
1 parent 53951d7 commit 2a6a895
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ export default function openDebuggerMiddleware({
if (!target && typeof appId === 'string') {
target = targets.find(_target => _target.description === appId);
}
} else {
} else if (targets.length > 0) {
logger?.info(
(launchType === 'launch' ? 'Launching' : 'Redirecting to') +
' JS debugger for first available target...',
` JS debugger${targets.length === 1 ? '' : ' for most recently connected target'}...`,
);
target = targets[0];
target = targets[targets.length - 1];
}

if (!target) {
Expand Down

0 comments on commit 2a6a895

Please sign in to comment.