From bf69c437cfc1191f2bae315fe09a160b27ccee16 Mon Sep 17 00:00:00 2001
From: m7kvqbe1 <48086589+m7kvqbe1@users.noreply.github.com>
Date: Wed, 27 Apr 2022 16:10:06 +0100
Subject: [PATCH] build(Storybook): Disable React.StrictMode behind env var
flag
Disabling by default for now because `focus-trap-react` is throwing StrictMode errors:
https://github.com/focus-trap/focus-trap-react/issues/77
Also worth nothing that currently StrictMode does not work in the Docs tab (only Canvas):
https://github.com/storybookjs/storybook/issues/17880
---
packages/react-component-library/.storybook/main.js | 3 +++
packages/react-component-library/.storybook/preview.js | 9 ++-------
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/packages/react-component-library/.storybook/main.js b/packages/react-component-library/.storybook/main.js
index ec06a41b8d..f75747de41 100644
--- a/packages/react-component-library/.storybook/main.js
+++ b/packages/react-component-library/.storybook/main.js
@@ -20,4 +20,7 @@ module.exports = {
${process.env.NETLIFY ? newRelic.script : ''}
`,
stories: ['../src/**/*.stories.tsx'],
+ reactOptions: {
+ strictMode: process.env.REACT_STRICT_MODE === '1',
+ },
}
diff --git a/packages/react-component-library/.storybook/preview.js b/packages/react-component-library/.storybook/preview.js
index d8bd1b5971..2ed015107f 100644
--- a/packages/react-component-library/.storybook/preview.js
+++ b/packages/react-component-library/.storybook/preview.js
@@ -58,11 +58,6 @@ export const parameters = {
}
export const decorators = [
- (Story) => (
-
-
-
-
-
- ),
+ // https://github.com/storybookjs/storybook/issues/15223#issuecomment-1092837912
+ (Story) => {Story()},
]