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

Log errors when loading stories on device fails #358

Merged
merged 1 commit into from
Jul 14, 2022

Conversation

micheleb
Copy link
Contributor

Issue: I had a typo in a style definition for one of my components, and although everything worked fine on web, the React Native expo app would stop loading all my stories, without logging any error on the console.

What I did

I added a try / catch block around the loadable() function inside loadCsf.ts, so that any error that happens inside the configure() call (inside .ondevice/storybook.requires.js) gets logged.

How to test

  • Add an invalid field (e.g., aspecRatio, with a missing t) to a style used by one of your components, and include it in a story
  • Run expo start
  • Launch storybook via expo on your device
  • You should now get an error message in your console like:
    "aspecRatio" is not a valid style property.
    StyleSheet myStyle: {
      "aspecRatio": 1.5,
    }
    Valid style props: [
      "alignContent",
      "alignItems",
      ...```
    
    

@micheleb micheleb requested a review from dannyhw as a code owner May 31, 2022 15:28
@dannyhw
Copy link
Member

dannyhw commented Jun 8, 2022

@micheleb hey thanks for the contribution 🙇 . Sorry I haven't had much time recently, I'll check this soon.

@dannyhw
Copy link
Member

dannyhw commented Jul 14, 2022

Looks good! 👍

@dannyhw dannyhw merged commit d75d12f into storybookjs:next-6.0 Jul 14, 2022
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.

2 participants