fix(client): don't display act error in fcc console (#53410)

This commit is contained in:
Krzysztof G 2024-01-30 21:50:19 +01:00 committed by GitHub
parent 933bbe7758
commit 293e2437f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -209,6 +209,8 @@ const mountFrame =
};
};
const actRE = new RegExp(/act\(\.\.\.\) is not supported in production builds/);
const updateProxyConsole =
(proxyLogger?: ProxyLogger) => (frameContext: Context) => {
// window does not exist if the preview is hidden, so we have to check.
@ -248,7 +250,9 @@ const updateProxyConsole =
frameContext.window.console.error = function proxyWarn(
...args: string[]
) {
proxyLogger(args.map((arg: string) => utilsFormat(arg)).join(' '));
if (args.every(arg => !actRE.test(arg))) {
proxyLogger(args.map((arg: string) => utilsFormat(arg)).join(' '));
}
return oldError(...(args as []));
};
}