mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
fix(community-cli-plugin): Add description in target debugs to distinguish RN Bridge and reanimated (#54198)
Summary: As I point out in this [issue](https://github.com/facebook/react-native/issues/50696#issuecomment-3418457545), when integrating reanimated, we end up with two debug targets having the same title. This can confuse and lead people to think something is wrong. Adding the description alongside the title to better explain where the second debug target comes from eliminates the confusion. Changelog: [Internal] Pull Request resolved: https://github.com/facebook/react-native/pull/54198 Test Plan: Tested in [this RN 82 project](https://github.com/dprevost-LMI/rn82/tree/reanimated) with the latest reanimated by overriding the code in the `node_module` Before: <img width="406" height="94" alt="Screenshot 2025-10-18 at 10 52 18 AM" src="https://github.com/user-attachments/assets/e517bf53-5176-479f-9fbb-3f4b46089395" /> After: <img width="522" height="78" alt="Screenshot 2025-10-18 at 10 56 27 AM" src="https://github.com/user-attachments/assets/aa14aebd-4c13-4249-bb00-63972302ab40" /> Reviewed By: hoxyq Differential Revision: D85041647 Pulled By: huntie fbshipit-source-id: 0a1cc9cc2fb0fadf31c8c60de19d77cfb01d072a
This commit is contained in:
1 parent
b78099b821
commit
6addea5d0c
1 file changed
+12
-8
@@ -94,22 +94,26 @@ export default class OpenDebuggerKeyboardHandler {
|
||||
const target = targets[0];
|
||||
void this.#tryOpenDebuggerForTarget(target);
|
||||
} else {
|
||||
this.#targetsShownForSelection = targets;
|
||||
|
||||
if (targets.length > 9) {
|
||||
this.#log(
|
||||
'warn',
|
||||
'10 or more debug targets available, showing the first 9.',
|
||||
);
|
||||
}
|
||||
const targetsShown = targets.slice(0, 9);
|
||||
const hasDuplicateTitles =
|
||||
new Set(targetsShown.map(target => target.title)).size <
|
||||
targetsShown.length;
|
||||
this.#targetsShownForSelection = targetsShown;
|
||||
|
||||
this.#setTerminalMenu(
|
||||
`Multiple debug targets available, please select:\n ${targets
|
||||
.slice(0, 9)
|
||||
.map(
|
||||
({title}, i) =>
|
||||
`${styleText(['white', 'inverse'], ` ${i + 1} `)} - "${title}"`,
|
||||
)
|
||||
`Multiple debug targets available, please select:\n ${targetsShown
|
||||
.map(({title, description}, i) => {
|
||||
const descriptionSuffix = hasDuplicateTitles
|
||||
? ` (${description})`
|
||||
: '';
|
||||
return `${styleText(['white', 'inverse'], ` ${i + 1} `)} - "${title}${descriptionSuffix}"`;
|
||||
})
|
||||
.join('\n ')}`,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user