Skip to content

Commit

Permalink
chore: suppress Relay warning messages in development mode (#2852)
Browse files Browse the repository at this point in the history
  • Loading branch information
yomybaby authored Nov 25, 2024
1 parent c28998e commit a6cde1a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions react/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@ import ReactDOM from 'react-dom/client';
import { useTranslation } from 'react-i18next';
import { Route, Routes } from 'react-router-dom';

// To maintain compatibility with various manager versions, the WebUI client uses directives to manipulate GraphQL queries.
// This can cause Relay to show "Warning: RelayResponseNormalizer: Payload did not contain a value for field" in the browser console during development.
// It's advisable to ignore these frequent logs in development mode.
if (process.env.NODE_ENV === 'development') {
const originalConsoleError = console.error;
console.error = function (message, ...args) {
if (
typeof message === 'string' &&
message.includes(
'Warning: RelayResponseNormalizer: Payload did not contain a value for field',
)
) {
return;
}
originalConsoleError.apply(console, [message, ...args]);
};
}

// Load custom theme config once in react/index.tsx
loadCustomThemeConfig();

Expand Down

0 comments on commit a6cde1a

Please sign in to comment.