Storybook: storyshots: Unexpected loaded state. Did you call `load` twice?

Created on 13 May 2020  路  13Comments  路  Source: storybookjs/storybook

Describe the bug
I have a setup using storyshots / storyshots-puppeteer and I want to make a screenshot of a story on multiple devices. When I execute the code I receive a warning.

Unexpected loaded state. Did you call load twice?

Expected behavior
No warning.

Screenshots
1

Code snippets

import initStoryshots from '@storybook/addon-storyshots'
import { devices } from 'puppeteer'

function createCustomizePage(pupDevice) {
  return page => page.emulate(pupDevice)
}

['iPad', 'iPhone X'].forEach(supportedDevice => {
  const pupDevice = devices[supportedDevice]

  const customizePage = createCustomizePage(pupDevice)

  initStoryshots({
    suite: `Image storyshots: ${pupDevice.name}`,
    test: imageSnapshot({
      customizePage,
    }),
  })
})

System:
System:
OS: macOS Mojave 10.14.6
CPU: (4) x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
Binaries:
Node: 12.16.1 - ~/.nvm/versions/node/v12.16.1/bin/node
Yarn: 1.22.4 -
npm: 6.13.4 - ~/.nvm/versions/node/v12.16.1/bin/npm
Browsers:
Chrome: 81.0.4044.138
Firefox: 67.0
Safari: 13.1
npmPackages:
@storybook/addon-actions: 5.3.18 => 5.3.18
@storybook/addon-backgrounds: 5.3.18 => 5.3.18
@storybook/addon-centered: 5.3.18 => 5.3.18
@storybook/addon-contexts: 5.3.18 => 5.3.18
@storybook/addon-docs: 5.3.18 => 5.3.18
@storybook/addon-knobs: 5.3.18 => 5.3.18
@storybook/addon-links: 5.3.18 => 5.3.18
@storybook/addon-notes: 5.3.18 => 5.3.18
@storybook/addon-storyshots: 5.3.18 => 5.3.18
@storybook/addon-storyshots-puppeteer: 5.3.18 => 5.3.18
@storybook/addon-viewport: 5.3.18 => 5.3.18
@storybook/addons: 5.3.18 => 5.3.18
@storybook/codemod: 5.3.18 => 5.3.18
@storybook/vue: 5.3.18 => 5.3.18

Additional context
The screenshots look correct. There are no errors.

PN storyshots question / support todo

Most helpful comment

@shilman it says I cannot use both main and config files. But I figured out my issue. I loaded stories twice - once in config file and second time in main, using glob pattern. Removed manual loading from config and it works like charm! Thanks for pushing towards right direction!

All 13 comments

Or if I'm just interested in having multiple test types utilizing storyshots, is there a way to suppress this warning?

```import initStoryshots from '@storybook/addon-storyshots';
import { imageSnapshot } from '@storybook/addon-storyshots-puppeteer';

initStoryshots({ suite: 'Storyshots' });
initStoryshots({ suite: 'Image Storyshots', test: imageSnapshot({ storybookUrl: 'http://localhost:6006' }) });
```

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

Activate.

Got same issue with following config:

    "@storybook/addon-actions": "5.3.18",
    "@storybook/addon-links": "5.3.18",
    "@storybook/addon-storyshots": "^5.3.18",
    "@storybook/addons": "5.3.18",
    "@storybook/preset-create-react-app": "^3.1.2",
    "@storybook/react": "5.3.18",

Update: tried 5.3.19 version, still got the same warning :(

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

I'm on 5.3.19 and have similar to @DDDDDanica config and also experiencing this issue.

Does the error still occur in 6.0-RC? npx sb@next upgrade --prerelease

@shilman it says I cannot use both main and config files. But I figured out my issue. I loaded stories twice - once in config file and second time in main, using glob pattern. Removed manual loading from config and it works like charm! Thanks for pushing towards right direction!

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

For my case, after upgrading to storybook 6, since config.js got removed as upgrading recommendation, my issue is gone too. So I believe @jaxxreal is right it is related with my old config.js before.

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

The issue that its not possible to call initStoryshots twice within one test run which @svewag and @jaruesink mentioned still persists. We have it too.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rpersaud picture rpersaud  路  3Comments

shilman picture shilman  路  3Comments

alexanbj picture alexanbj  路  3Comments

wahengchang picture wahengchang  路  3Comments

xogeny picture xogeny  路  3Comments