Fetch root config when version doesn't have one #13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 onfetch
specifications, it will always return a promise that resolves to aResponse
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.