Skip to content

Commit 2a6a895

Browse files
robhoganfacebook-github-bot
authored andcommitted
Debugger: j opens debugger on most recently connected target (facebook#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
1 parent 53951d7 commit 2a6a895

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/dev-middleware/src/middleware/openDebuggerMiddleware.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ export default function openDebuggerMiddleware({
8686
if (!target && typeof appId === 'string') {
8787
target = targets.find(_target => _target.description === appId);
8888
}
89-
} else {
89+
} else if (targets.length > 0) {
9090
logger?.info(
9191
(launchType === 'launch' ? 'Launching' : 'Redirecting to') +
92-
' JS debugger for first available target...',
92+
` JS debugger${targets.length === 1 ? '' : ' for most recently connected target'}...`,
9393
);
94-
target = targets[0];
94+
target = targets[targets.length - 1];
9595
}
9696

9797
if (!target) {

0 commit comments

Comments
 (0)