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

INSTUI-2878 Upgrade storybook to 6.1.18 #399

Merged
merged 8 commits into from
Feb 26, 2021
Merged

INSTUI-2878 Upgrade storybook to 6.1.18 #399

merged 8 commits into from
Feb 26, 2021

Conversation

matyasf
Copy link
Collaborator

@matyasf matyasf commented Feb 17, 2021

Uprade storybook to the latest version, hopefully this will help with the Chromatic issues. Also removed some exotic code.

@matyasf matyasf requested review from ke1k0 and Brailor February 17, 2021 22:51
@matyasf matyasf self-assigned this Feb 17, 2021

module.exports = {
stories: ['../stories.js']
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@@ -48,54 +35,9 @@ addParameters({
name: 'instructure-ui',
brandUrl: 'https://instructure.design',
brandImage:
'https://instructure.design/icons-bea652a7d0546b99c7cba9d3b4a538ee/favicon-32x32.png'
'https://instructure.design/icons-bea652a7d0546b99c7cba9d3b4a538ee/favicon-32x32.png' // TODO this URL is broken
}),
showPanel: false,
isFullscreen: false
}
})
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

* SOFTWARE.
*/

import { storiesOf } from '@storybook/react'
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Although storiesOf API is legacy https://github.com/storybookjs/storybook/blob/next/lib/core/docs/storiesOf.md they do not seem to offer a new API to programatically load lots of stories, see storybookjs/storybook#9828

'../../',
true,
/^.*\/src\/.*\.examples\.js$/,
'lazy'
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was one of the things causing issues with Storybook 6. We were loading our modules lazily with a promise (this is some barely documented Webpack feature) that caused Storybook to throw errors saying "Error: Cannot add a story when not configuring ...". I've set this to 'sync', see stories.js

@matyasf matyasf changed the title Upgrade storybook to 6.1.18 INSTUI-2878 Upgrade storybook to 6.1.18 Feb 18, 2021
@Brailor
Copy link
Contributor

Brailor commented Feb 19, 2021

Somehow not all of our examples are shown with this new upgrade.
With the previous version of Storybook we had 50+ components, with this new version only 14 of them are being show when I run yarn dev:examples.
Could you check this out?

Comment on lines -99 to -105
if (!config.renderPage) {
console.warn('A default is no longer provided for \`renderPage\`, you should supply it to the config instead')
}

if (!config.renderExample) {
console.warn('A default is no longer provided for \`renderExample\`, you should supply it to the config instead')
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

here they likely wanted to check the opposite (if (config.renderExample)), see 3abd6ca#diff-f82b6242f20fe2b1c9d6cf5c3522ad1c9463b3a9d8bd703c307050df0f079007

Copy link
Contributor

@Brailor Brailor left a comment

Choose a reason for hiding this comment

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

Great work!

Copy link
Contributor

@ke1k0 ke1k0 left a comment

Choose a reason for hiding this comment

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

Img is still throwing error: Warning: Failed prop type: Invalid prop `src` of type `object` supplied to `Img`, expected `string`. in Img (created by unboundStoryFn) in unboundStoryFn in ErrorBoundary

Also, there is a conflict in yarn.lock

@matyasf
Copy link
Collaborator Author

matyasf commented Feb 22, 2021

Img is still throwing error: Warning: Failed prop type: Invalid prop `src` of type `object` supplied to `Img`, expected `string`. in Img (created by unboundStoryFn) in unboundStoryFn in ErrorBoundary

Also, there is a conflict in yarn.lock

hmm I fixed this in one place, then there must be other places where the src of the img is not set correctly

@matyasf
Copy link
Collaborator Author

matyasf commented Feb 26, 2021

Img is still throwing error: Warning: Failed prop type: Invalid prop `src` of type `object` supplied to `Img`, expected `string`. in Img (created by unboundStoryFn) in unboundStoryFn in ErrorBoundary

Also, there is a conflict in yarn.lock

I solved the conflict and fixed all the errors that components were throwing

@matyasf matyasf merged commit d032928 into next Feb 26, 2021
@matyasf matyasf deleted the storybook_upgrade branch February 26, 2021 13:10
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.

3 participants