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:
Billy Janitsch
2022-04-15 10:35:35 -05:00
committed by GitHub
parent d63cd97245
commit 726ba80298
2 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -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
View File
@@ -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 {