Skip to content

Commit

Permalink
Enable React strict mode (#339)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vadorequest authored May 27, 2021
1 parent ec7f95a commit 09bf035
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module.exports = withNextPluginPreval(withBundleAnalyzer(withSourceMaps({
*
* @see https://nextjs.org/docs/api-reference/next.config.js/react-strict-mode
*/
// reactStrictMode: true, // XXX Disabled for now, but we should enable it
reactStrictMode: true,

/**
* Environment variables added to JS bundle
Expand Down
8 changes: 7 additions & 1 deletion src/common/utils/ignoreNoisyWarningsHacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ console.error = (...args): void => {
// HACK: Muting error, fix as soon as https://github.com/vercel/next.js/issues/7915 gets resolved
return;
} else if (/Warning.*Expected server HTML to contain a matching/.test(args[0]) && /Footer/.test(args[3])) {
// XXX Silent false-positive warning (server doesn't render that part because it can't on server when using SSG, perfectly normal and not an actual issue)
// XXX Muting false-positive warning (server doesn't render that part because it can't on server when using SSG, perfectly normal and not an actual issue)
return;
} else if (/Warning: Legacy context API has been detected within a strict-mode tree/.test(args[0]) && /at AmplitudeProvider/.test(args[2])) {
// XXX Muting warning from AmplitudeProvider (can't do anything about it ourselves), see https://github.com/amplitude/react-amplitude/issues/48
return;
} else if (/Warning: %s is deprecated in StrictMode/.test(args[0]) && /reactstrap/.test(args[4])) {
// XXX Muting warning from Reactstrap (can't do anything about it ourselves)
return;
}
originalError.call(console, ...args);
Expand Down

0 comments on commit 09bf035

Please sign in to comment.