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

Fetch root config when version doesn't have one #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mshaaban088
Copy link

@mshaaban088 mshaaban088 commented Apr 4, 2018

If I have a directory structure like this

.
├── static
│   ├── manager.c2ca3b28e7a25aae27ab.bundle.js
│   └── preview.c03632fa3b30af3d9784.bundle.js
├── v1
│   ├── static
│   ├── favicon.ico
│   ├── iframe.html
│   └── index.html
├── v2
│   ├── static
│   ├── favicon.ico
│   ├── iframe.html
│   └── index.html
├── v3
│   ├── static
│   ├── favicon.ico
│   ├── iframe.html
│   └── index.html
├── favicon.ico
├── iframe.html
├── index.html
└── storybook-config.json

You should safely assume that there will be one storybook-config.json file stored in the root directory where you see all available-versions and other configs. IMHO this file shouldn't be redundant in every version.

The issue is, with the current implementation, in each version, the addon tries to load the storybook-config.json in that version, and if it is not there, it will reject the promise, that's based on fetch specifications, it will always return a promise that resolves to a Response object (ok will be false in case of 404), but we should instead load the config file from the root directory, and that's basically what I did.

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.

1 participant