From bc1f0f47e2af1ec8b2d1da0e8a2aaa8a5b6f46d4 Mon Sep 17 00:00:00 2001 From: Armin Mehinovic <4390250+arminmeh@users.noreply.github.com> Date: Tue, 10 Dec 2024 07:39:48 +0100 Subject: [PATCH] [license] Use `console.log` for the error message on Codesandbox to avoid rendering error (#15814) --- .../src/utils/licenseErrorMessageUtils.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/x-license/src/utils/licenseErrorMessageUtils.ts b/packages/x-license/src/utils/licenseErrorMessageUtils.ts index 0b0385bf2d3cc..2edfba26a509e 100644 --- a/packages/x-license/src/utils/licenseErrorMessageUtils.ts +++ b/packages/x-license/src/utils/licenseErrorMessageUtils.ts @@ -1,5 +1,19 @@ +/** + * Workaround for the codesadbox preview error. + * + * Once these issues are resolved + * https://github.com/mui/mui-x/issues/15765 + * https://github.com/codesandbox/codesandbox-client/issues/8673 + * + * `showError` can simply use `console.error` again. + */ +const isCodeSandbox = + typeof window !== 'undefined' && window.location.hostname.endsWith('.csb.app'); + function showError(message: string[]) { - console.error( + // eslint-disable-next-line no-console + const logger = isCodeSandbox ? console.log : console.error; + logger( [ '*************************************************************', '',