addon-info details disappear on reload ever since using req.keys().forEach((filename) => req(filename))
See original GitHub issueDescribe the bug Ever since I’ve started using the req.keys().forEach((filename) => req(filename)) pattern to load all of the stories in the directory, each time I change something in the component or the story, all of the addon-info details disappear from the story. If I put all of my stories under index.js it works fine.
Expected behavior Reload should not cause the addons info disappearing from iframe.
To Reproduce stories/index.js
import {configure} from '@storybook/react';
const req = require.context('./', true, /.Story.js$/);
function loadStories () {
req.keys().forEach((filename) => req(filename))
}
configure(loadStories, module);](url)
./storybook/config.js
import {addDecorator, configure} from '@storybook/react';
import {withInfo} from '@storybook/addon-info';
import {withKnobs} from '@storybook/addon-knobs';
function loadStories() {
require('../stories/index.js');
}
addDecorator(
withInfo({
inline: true,
header: true
})
);
addDecorator(withKnobs);
configure(loadStories, module);
ModalStory.js
import React from 'react';
import {storiesOf} from '@storybook/react';
import {UtModal, UtButton} from '../src';
storiesOf('Modal', module)
.add('With Trigger', () => (
<UtModal trigger={<UtButton>Click Here</UtButton>}>
<UtModal.Header>Select a Photo</UtModal.Header>
<UtModal.Content>
<div>test</div>
</UtModal.Content>
</UtModal>
));
package.json
{
"name": "@perionnet/ut-react-common",
"version": "1.0.6",
"description": "Undertone React common lib",
"main": "src/index.js",
"module": "dist/index.js",
"author": "Undertone",
"license": "ISC",
"peerDependencies": {
"react": "^16.6.0",
"react-dom": "^16.6.0"
},
"dependencies": {
"@perionnet/ut-icon": "^1.0.6",
"@storybook/addon-actions": "^4.0.8",
"autobind-decorator": "^2.3.1",
"classnames": "^2.2.6",
"cleave.js": "^1.4.4",
"color-hash": "^1.0.3",
"countup": "^1.8.2",
"express": "^4.16.4",
"lodash": "^4.17.11",
"lottie-web": "^5.4.2",
"md5": "^2.2.1",
"prop-types": "^15.6.2",
"react-select": "^2.1.2",
"react-transition-group": "^2.5.0",
"semantic-ui-css": "^2.4.1",
"semantic-ui-react": "^0.83.0",
"semantic-ui-sass": "^2.3.1",
"string-hash": "^1.1.3",
"string-template": "^1.0.0",
"textfit": "^2.3.1"
},
"devDependencies": {
"@babel/cli": "^7.1.5",
"@babel/core": "7.1.0",
"@babel/plugin-proposal-class-properties": "7.1.0",
"@babel/plugin-proposal-decorators": "^7.1.6",
"@babel/plugin-proposal-export-default-from": "^7.0.0",
"@babel/plugin-proposal-object-rest-spread": "7.0.0",
"@babel/plugin-syntax-dynamic-import": "7.0.0",
"@babel/plugin-transform-classes": "7.1.0",
"@babel/plugin-transform-destructuring": "7.0.0",
"@babel/plugin-transform-react-constant-elements": "7.0.0",
"@babel/plugin-transform-react-display-name": "7.0.0",
"@babel/plugin-transform-regenerator": "7.0.0",
"@babel/plugin-transform-runtime": "7.1.0",
"@babel/preset-env": "7.1.0",
"@babel/preset-flow": "7.0.0",
"@babel/preset-react": "7.0.0",
"@babel/runtime": "7.0.0",
"@storybook/addon-info": "^4.0.8",
"@storybook/addon-knobs": "^4.0.8",
"@storybook/react": "4.0.0-alpha.24",
"@types/react": "^16.7.7",
"babel-eslint": "^8.2.1",
"babel-loader": "^8.0.4",
"babel-plugin-react-docgen": "^2.0.0",
"css-loader": "^1.0.1",
"eslint": "^4.6.1",
"eslint-plugin-react": "^7.11.1",
"icon-font-generator": "^2.1.8",
"node-sass": "^4.10.0",
"nodemon": "^1.18.6",
"nps": "^5.7.1",
"nps-utils": "^1.3.0",
"parcel-bundler": "^1.10.3",
"react": "^16.6.3",
"react-dom": "^16.6.3",
"sass-loader": "^7.1.0",
"webpack": "4.20.2",
"webpack-cli": "^3.1.2"
},
"scripts": {
"storybook": "start-storybook -p 9001 -c .storybook",
"build-storybook": "build-storybook -c .storybook -o .out",
"start": "nps start",
"build": "nps build",
"prepublish": "nps build",
"watch": "nps build.watch",
"lint": "eslint ."
},
"files": [
"dist",
"lib",
"src"
]
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
addon-info details disappear on reload ever since using req ...
Ever since I've started using the req.keys().forEach((filename) => req(filename)) pattern to load all of the stories in the directory, each time ...
Read more >L4D AddonInfo Authoring - Valve Developer Community
In Left 4 Dead and Left 4 Dead 2, a addoninfo.txt provides metadata for an addon, which is used by both the addons...
Read more >eslint: failed to load config "next/babel" to extend from. - You.com
I was missing the package @vue/prettier/@typescript-eslint, after installing the package version matching my package.json, I was good. Hope that helps someone.
Read more >mozilla-release: changeset 533541 ... - Mercurial
+* http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +add_task(async function() { + Services.prefs.lockPref("browser.download.
Read more >wait until bundle finished, stopped at 99% [webpack 5] #14405
I use npm to install packages. OS: window 10 node: V10.22.0 npm : V6.14.6. storybook config: const custom = require('../../webpack.config.js') ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@maacky @yanivshiloah FYI I notice this issue even when only requiring the stories by context in the config file. I do use
require.context()in other places to dynamically import other types of files (notably, markdown files), but not the actual story files themselves.@yanivshiloah: I guess this happens only when you load your stories twice, in
/storybook/config.jsand then in/stories/index.js. Is there any reason you need to do this instead of loading them all in/storybook/config.jsonly, like so?This way you can still dynamically add all your stories from ‘/stories’ without breaking the addon behavior on reload.