Skip to content

Commit 6263ced

Browse files
authored
feat: use strict mode as default in storybook (#1759)
1 parent 6708d80 commit 6263ced

File tree

2 files changed

+4
-21
lines changed

2 files changed

+4
-21
lines changed

.storybook/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = {
2020
addons: ['@storybook/addon-essentials', '@storybook/addon-a11y', '@storybook/addon-designs'],
2121
framework: {
2222
name: '@storybook/react-webpack5',
23-
options: {}
23+
options: { strictMode: true }
2424
},
2525
core: {
2626
disableWhatsNewNotifications: true

.storybook/preview.js

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* found at http://www.apache.org/licenses/LICENSE-2.0.
66
*/
77

8-
import React, { StrictMode } from 'react';
8+
import React from 'react';
99
import styled, { createGlobalStyle } from 'styled-components';
1010
import { create } from '@storybook/theming/create';
1111
import { ThemeProvider, DEFAULT_THEME, getColorV8 } from '../packages/theming/src';
@@ -77,10 +77,7 @@ const withThemeProvider = (story, context) => {
7777
);
7878
};
7979

80-
const withStrictMode = (story, context) =>
81-
context.globals.strictMode === 'enabled' ? <StrictMode>{story()}</StrictMode> : <>{story()}</>;
82-
83-
export const decorators = [withThemeProvider, withStrictMode];
80+
export const decorators = [withThemeProvider];
8481

8582
export const globalTypes = {
8683
locale: {
@@ -118,19 +115,5 @@ export const globalTypes = {
118115
{ value: 'fuschia', title: 'Custom primary hue' }
119116
]
120117
}
121-
},
122-
...(process.env.NODE_ENV === 'development' && {
123-
strictMode: {
124-
name: 'strictMode',
125-
description: 'Strict mode',
126-
defaultValue: 'disabled',
127-
toolbar: {
128-
icon: 'alert',
129-
items: [
130-
{ value: 'disabled', title: 'Strict mode disabled' },
131-
{ value: 'enabled', title: 'Strict mode enabled' }
132-
]
133-
}
134-
}
135-
})
118+
}
136119
};

0 commit comments

Comments
 (0)