cypress-storybook icon indicating copy to clipboard operation
cypress-storybook copied to clipboard

forceReRender was removed in storyStoreV7, breaking cypress-storybook

Open micahgodbolt opened this issue 3 years ago • 3 comments

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 avatar Mar 11 '22 01:03 micahgodbolt

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) `

yunic-nl avatar Jul 10 '23 09:07 yunic-nl

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'));

gabrielgagne avatar Jul 10 '23 17:07 gabrielgagne

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

yunic-nl avatar Jul 11 '23 09:07 yunic-nl