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

[addon:google-analytics] throws "path is required in .pageview()" error #6012

Closed
thundermiracle opened this issue Mar 11, 2019 · 10 comments
Closed

Comments

@thundermiracle
Copy link

Describe the bug
throws [react-ga] path is required in .pageview() when upgrade to storybook 5.0.x

To Reproduce
Steps to reproduce the behavior:

  1. add addon-google-analytics
  2. select another story after page loaded

Expected behavior
No error throws.

Screenshots
https://thundermiracle.github.io/storybook-loader/?path=/story/documentation-basic--description
then open the debug console and change to another story

Code snippets

import '@storybook/addon-google-analytics/register';
window.STORYBOOK_GA_ID = 'UA-119418003-1';

System:

  • OS: Windows10
  • Device: PC
  • Browser: chrome
  • Framework: react
  • Addons: google-analytics
  • Version: 5.0.0 (same in 5.0.1)

Additional context
api.getUrlState() returns { url: undefined } instead of { url: '/xxx/xxxx' } after upgrade to 5.0.x.
Is there something missing in core/context.js?

@jholt1
Copy link

jholt1 commented Apr 29, 2019

@shilman @thundermiracle Should this issue be closed? I don't see that it has been fixed in Storybook.

@shilman shilman reopened this Apr 29, 2019
@stale
Copy link

stale bot commented May 20, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label May 20, 2019
@shilman shilman removed the inactive label May 20, 2019
@shilman shilman modified the milestones: 5.0.x, 5.1.x Jun 5, 2019
@happinessEngineer
Copy link

I am seeing the same issue with the latest version of the addon and storybook/react (both v5.1.8).

@stale stale bot added the inactive label Jul 10, 2019
@storybookjs storybookjs deleted a comment from stale bot Jul 10, 2019
@stale stale bot removed the inactive label Jul 10, 2019
@ndelangen
Copy link
Member

I cannot reproduce, using the @thundermiracle steps to reproduce, this https://thundermiracle.github.io/storybook-loader/?path=/story/documentation-basic--description seems to not log errors for me.

What am I doing wrong, or has this been fixed?

@ndelangen ndelangen removed this from the 5.1.x milestone Jul 13, 2019
@thundermiracle
Copy link
Author

@ndelangen Sorry, I fixed it by customizing google-analytics addon, so the steps to reproduce is wrong.

@stale stale bot added the inactive label Aug 3, 2019
@jamime
Copy link

jamime commented Aug 28, 2019

@ndelangen, @shilman this is still an issue and is reproducible. Although the issue extends beyond the google-analytics plugin.

  1. npx create-react-app my-app
  2. cd my-app
  3. npx -p @storybook/cli sb init
  4. Update addons.js
import '@storybook/addon-actions/register';
import '@storybook/addon-links/register';
import { STORY_CHANGED, STORY_ERRORED, STORY_MISSING } from '@storybook/core-events';
import addonAPI from '@storybook/addons';
addonAPI.register('my-organisation/my-addon', api => {
    api.on(STORY_CHANGED, () => {
        console.log(api.getUrlState().url);
      });
});

This will always log undefined.

This usage is documented here, but it does not state what the url format is.

I have not found any tests for getUrlState so I am unsure what format should be returned, or if it has been deprecated.

@thundermiracle is correct that the addon plugin could be fixed by passing the path instead of the url

@stale
Copy link

stale bot commented Sep 19, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Sep 19, 2019
@soundasleep
Copy link
Contributor

soundasleep commented Oct 18, 2019

This behaviour is still broken in 5.1.11.

[react-ga] path is required in .pageview()

PR #8468 may fix this?

@stale stale bot removed the inactive label Oct 18, 2019
@stale
Copy link

stale bot commented Nov 8, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Nov 8, 2019
@shilman
Copy link
Member

shilman commented Nov 30, 2019

Crikey!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.2.7 containing PR #8468 that references this issue. Upgrade today to try it out!

Closing this issue. Please re-open if you think there's still more to do.

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

7 participants