Skip to content

Commit 1fceb38

Browse files
committed
Enable strict mode by default in storybook, and hide in production builds
1 parent 2f40aa8 commit 1fceb38

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

.storybook/custom-addons/strictmode/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React, {StrictMode, useEffect, useState} from 'react';
44

55
function StrictModeDecorator(props) {
66
let {children} = props;
7-
let [isStrict, setStrict] = useState(getQueryParams()?.strict === 'true' || false);
7+
let [isStrict, setStrict] = useState(getQueryParams()?.strict !== 'false');
88

99
useEffect(() => {
1010
let channel = addons.getChannel();

.storybook/custom-addons/strictmode/register.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React, {useEffect, useState} from 'react';
44

55
const StrictModeToolBar = ({api}) => {
66
let channel = addons.getChannel();
7-
let [isStrict, setStrict] = useState(getQueryParams()?.strict === 'true' || false);
7+
let [isStrict, setStrict] = useState(getQueryParams()?.strict !== 'false');
88
let onChange = () => {
99
setStrict((old) => {
1010
channel.emit('strict/updated', !old);

.storybook/preview.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ export const parameters = {
2626

2727
export const decorators = [
2828
withScrollingSwitcher,
29-
withStrictModeSwitcher,
29+
...(process.env.NODE_ENV !== 'production' ? [withStrictModeSwitcher] : []),
3030
withProviderSwitcher
3131
];

0 commit comments

Comments
 (0)