Fix React Native auto-selection for duplicate debugger targets#14
Open
Fix React Native auto-selection for duplicate debugger targets#14
Conversation
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
Users connecting to React Native through Metro now get a single effective target when Metro exposes duplicate entries for the same device and app, and agent-cdp auto-selects the newest one. This prevents the common failure mode where the tool attaches to an older page like
...-1instead of the active debugger page like...-2.Backward compatibility
Existing Chrome target discovery is unchanged. Existing React Native discovery remains compatible for unique targets; this only collapses duplicate React Native entries whose ids match the
<logicalDeviceId>-<number>pattern and share the same discovery source, app id, and logical device id. Daemon lifecycle, CLI commands, output format, and target id format remain unchanged.Risks
React Native target lists that intentionally rely on multiple pages for the same app and logical device could now show only the newest matching entry. This is limited to duplicate-style ids from Metro and does not affect non-matching React Native ids or Chrome targets.
Manual testing
...-1and...-2.agent-cdp target list --url http://127.0.0.1:8081and verify only the newest matching React Native target is shown.agent-cdp target clear, then run a command that auto-selects a target, such asagent-cdp console list.