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

SWC-6545 pre-work - Upgrade Storybook + expose ability to enable StrictMode #711

Merged
merged 3 commits into from
Feb 16, 2024

Conversation

nickgros
Copy link
Collaborator

@nickgros nickgros commented Feb 14, 2024

  • Upgrade Storybook to latest version (7.6.15)
  • Expose ability to enable React StrictMode in Storybook
  • Replace deprecated @storybook/addon-styling with @storybook/addon-themes
  • Replace deprecated storybook-addon-designs with @storybook/addon-designs

I was trying to upgrade react-query to v5 (SWC-6545) and found that our Challenge Portal components relied on features that were removed from react-query (e.g. onSuccess/onSettled callbacks for useQuery). The features were removed because they were often used improperly, leading to bugs. The Challenge Portal components indeed used these callbacks improperly, so I was working to fix them and additionally remove unnecessary useEffect hooks.

To attempt to identify new issues with the effect hooks, I enabled StrictMode. However, StrictMode did not work properly in Storybook, with a fix in v7.6.13 (storybookjs/storybook#22472), so this upgrade is necessary to enable StrictMode.

- Upgrade Storybook to latest version (7.6.15)
- Enable React StrictMode in Storybook
- Replace deprecated @storybook/addon-styling with @storybook/addon-themes

I was trying to upgrade react-query to v5 (SWC-6545) and found that our Challenge Portal components relied on features that were removed from react-query (e.g. onSuccess/onSettled callbacks for useQuery). The features were removed because they were often used improperly, leading to bugs. The Challenge Portal components indeed used these callbacks improperly, so I was working to fix them and additionally remove unnecessary `useEffect` hooks.

To attempt to identify new issues with the effect hooks, I enabled StrictMode. However, StrictMode did not work properly in Storybook, with a fix in v7.6.13 (storybookjs/storybook#22472), so this upgrade is necessary to enable StrictMode.
@nickgros nickgros changed the title SWC-6545 pre-work - Upgrade Storybook + Enable StrictMode SWC-6545 pre-work - Upgrade Storybook + expose ability to enable StrictMode Feb 16, 2024
],

framework: {
name: '@storybook/react-vite',
options: {
strictMode: false,
Copy link
Collaborator Author

@nickgros nickgros Feb 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered enabling StrictMode by default, but wasn't sure if that might cause problems with stories. Explicitly setting it to false here makes it easy to go in and change it locally when desired. In the future, we can decide to enable it globally.

@nickgros nickgros merged commit 8983b6a into Sage-Bionetworks:main Feb 16, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants