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

Google Analytics storyMissing undefined #7292

Closed
claudio-moya opened this issue Jul 4, 2019 · 3 comments
Closed

Google Analytics storyMissing undefined #7292

claudio-moya opened this issue Jul 4, 2019 · 3 comments
Assignees
Milestone

Comments

@claudio-moya
Copy link

Describe the bug
The plugin trigger an error exception when there are missed stories.

To Reproduce
Steps to reproduce the behavior:

  1. Use default setup using type react.
  2. Enable the addon in addons.js (import '@storybook/addon-google-analytics/register';)
  3. Run the project using the root localhost path (ex.: http://localhost:8080)
  4. After the router redirects you to any of the stories, the error is triggered.
  5. Open the developers console and see the error:
    TypeError: Cannot read property 'id' of undefined

Expected behavior
Run the project and don't show an error during the router changes from root path to stories path.

Screenshots
storybook-addon-google-analytics

Code snippets
The issue is located at register.ts due to the id variable is undefined.

api.on(STORY_MISSING, ({ id }: { id: string }) => { //<-- id is undefined here
    ReactGA.exception({
      description: `attempted to render ${id}, but it is missing`,
      fatal: false,
    });
  });

System:

  • OS: MacOS
  • Device: Macbook Pro Retina
  • Browser: Chrome, Safari, Firefox
  • Framework: react
  • Addons: addon-google-analytics
  • Version: v5.1.9

Additional context

@chris-dura
Copy link
Contributor

I’m experiencing the same thing for @storybook/html

@shilman
Copy link
Member

shilman commented Jul 13, 2019

ZOMG!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.2.0-alpha.43 containing PR #7410 that references this issue. Upgrade today to try it out!

You can find this prerelease on the @next NPM tag.

@shilman
Copy link
Member

shilman commented Jul 31, 2019

Great Caesar's ghost!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.1.10 containing PR #7410 that references this issue. Upgrade today to try it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants