From ea24bdb1023b2cfffa9c787569f8f86a1a279d9c Mon Sep 17 00:00:00 2001 From: asvarcas Date: Sun, 10 Nov 2019 22:57:05 -0300 Subject: [PATCH] Don't leave dataProvider console logs in production. --- packages/ra-core/src/dataProvider/useDataProvider.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/ra-core/src/dataProvider/useDataProvider.ts b/packages/ra-core/src/dataProvider/useDataProvider.ts index 9c1bb6870b2..0bfb26c8b33 100644 --- a/packages/ra-core/src/dataProvider/useDataProvider.ts +++ b/packages/ra-core/src/dataProvider/useDataProvider.ts @@ -274,7 +274,9 @@ const performUndoableQuery = ({ warnBeforeClosingWindow ); } - console.error(error); + if (process.env.NODE_ENV !== 'production') { + console.error(error); + } return logoutIfAccessDenied(error).then(loggedOut => { if (loggedOut) return; dispatch({ @@ -356,7 +358,9 @@ const performQuery = ({ return response; }) .catch(error => { - console.error(error); + if (process.env.NODE_ENV !== 'production') { + console.error(error); + } return logoutIfAccessDenied(error).then(loggedOut => { if (loggedOut) return; dispatch({