Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable react strict mode (-at) #340

Merged
merged 1 commit into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
6 changes: 6 additions & 0 deletions src/common/utils/ignoreNoisyWarningsHacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ console.error = (...args): void => {
} 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)
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