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

fix missing supported extension check in case when asset is a string #2468

Merged
merged 2 commits into from
Dec 12, 2017

Conversation

folmert
Copy link
Contributor

@folmert folmert commented Dec 12, 2017

I've came across this inconsistent logic while investigating my own issue: #2363

There is a check in case of an Object, but there is none in case of String. This might lead to hardly explainable errors.

What I did

I've added the missing check.

How to test

See the issue.

Is this testable with jest or storyshots?
Yes.

Does this need a new example in the kitchen sink apps?
No.

Does this need an update to the documentation?
No.

I've came across this inconsistent logic while investigating my own issue: storybookjs#2363
@@ -29,7 +29,9 @@ const urlsFromAssets = assets => {
.forEach(key => {
let asset = assets[key];
if (typeof asset === 'string') {
urls[getExtensionForFilename(asset)].push(asset);
if (Boolean(urls[getExtensionForFilename(asset)])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine but we usually just do !!(urls[getExtensionForFilename(asset)]) to convert into boolean

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I copied it from few lines below. But actually it can be simplified to just if (urls[getExtensionForFilename(asset)]) { ... } - otherwise CircleCI test fails at no-extra-boolean-cast rule.

@codecov
Copy link

codecov bot commented Dec 12, 2017

Codecov Report

Merging #2468 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2468   +/-   ##
=======================================
  Coverage   16.87%   16.87%           
=======================================
  Files         307      307           
  Lines        7792     7792           
  Branches      785      779    -6     
=======================================
  Hits         1315     1315           
- Misses       5819     5843   +24     
+ Partials      658      634   -24
Impacted Files Coverage Δ
app/vue/src/server/iframe.html.js 0% <ø> (ø) ⬆️
addons/knobs/src/components/types/Date/index.js 23.52% <0%> (ø) ⬆️
addons/knobs/src/components/types/Color.js 8.21% <0%> (ø) ⬆️
...b/ui/src/modules/ui/components/down_panel/index.js 34.78% <0%> (ø) ⬆️
lib/ui/src/libs/key_events.js 23.25% <0%> (ø) ⬆️
...ents/src/manager/components/CommentsPanel/index.js 0% <0%> (ø) ⬆️
lib/ui/src/modules/api/index.js 0% <0%> (ø) ⬆️
app/react-native/src/bin/storybook.js 0% <0%> (ø) ⬆️
addons/jest/src/components/PanelTitle.js 0% <0%> (ø) ⬆️
...tive/src/preview/components/StoryListView/index.js 0% <0%> (ø) ⬆️
... and 39 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e6a776b...5645a0a. Read the comment docs.

@ndelangen ndelangen merged commit a60a822 into storybookjs:master Dec 12, 2017
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.

3 participants