mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Synchronize implementations of second render logging (#24381)
Minor followup to #24373. The fix for #24373 (comment) didn't get synchronized to the hook implementation.
This commit is contained in:
+1
-1
@@ -187,7 +187,7 @@ export function formatWithStyles(
|
||||
return inputArgs;
|
||||
}
|
||||
|
||||
// Matches any of %(o|O|i|s|f), but not %%(o|O|i|s|f)
|
||||
// Matches any of %(o|O|d|i|s|f), but not %%(o|O|d|i|s|f)
|
||||
const REGEXP = /([^%]|^)(%([oOdisf]))/g;
|
||||
if (inputArgs[0].match(REGEXP)) {
|
||||
return [`%c${inputArgs[0]}`, style, ...inputArgs.slice(1)];
|
||||
|
||||
+5
-2
@@ -180,13 +180,16 @@ export function installHook(target: any): DevToolsHook | null {
|
||||
inputArgs === undefined ||
|
||||
inputArgs === null ||
|
||||
inputArgs.length === 0 ||
|
||||
(typeof inputArgs[0] === 'string' && inputArgs[0].includes('%c')) ||
|
||||
// Matches any of %c but not %%c
|
||||
(typeof inputArgs[0] === 'string' &&
|
||||
inputArgs[0].match(/([^%]|^)(%c)/g)) ||
|
||||
style === undefined
|
||||
) {
|
||||
return inputArgs;
|
||||
}
|
||||
|
||||
const REGEXP = /(%?)(%([oOdisf]))/g;
|
||||
// Matches any of %(o|O|d|i|s|f), but not %%(o|O|d|i|s|f)
|
||||
const REGEXP = /([^%]|^)(%([oOdisf]))/g;
|
||||
if (inputArgs[0].match(REGEXP)) {
|
||||
return [`%c${inputArgs[0]}`, style, ...inputArgs.slice(1)];
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user