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

forceReRender was removed in storyStoreV7, breaking cypress-storybook #46

Open
micahgodbolt opened this issue Mar 11, 2022 · 3 comments

Comments

@micahgodbolt
Copy link

Storybook 6.4 has the ability to turn on a flag and enable storyStorev7

https://storybook.js.org/docs/react/configure/overview#feature-flags

storyStorev7 removed the forceReRender api https://github.com/storybookjs/storybook/blob/next/lib/core-client/src/preview/start.ts#L45

cypress-storybook relies on forceReRender to be called anytime knobs change

https://github.com/NicholasBoll/cypress-storybook/blob/master/react.js#L18

Seeing as knobs have been deprecated for a while, it seems reasonable to remove support knobs for them in a major release and remove the dependence on a forceReRender

https://storybook.js.org/addons/@storybook/addon-knobs

@micahgodbolt micahgodbolt changed the title forceReRender was removed in storyStoreV7 forceReRender was removed in storyStoreV7, breaking cypress-storybook Mar 11, 2022
@yunic-nl
Copy link

Hi Micah,
I had the same issue, we added the following to have it working again in Storybook 7. Maybe it will help you with fixing your issue as well.

`
import { addons } from '@storybook/preview-api';
import { FORCE_RE_RENDER } from '@storybook/core-events';

//re-render call
addons.getChannel().emit(FORCE_RE_RENDER)
`

@gabrielgagne
Copy link

Glad i'm not the only one facing this
@yunic-nl Where did you add this? My test fails first thing when loading the story in the one and only beforeEach
beforeEach(() => cy.visitStorybook().loadStory('AsyncValidation', 'Primary'));

@yunic-nl
Copy link

We used it in the preview.ts (working on Angular project)

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

No branches or pull requests

3 participants