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

TypeError: Cannot read property 'pathname' of null #13

Closed
thomasparsons opened this issue Mar 12, 2018 · 2 comments
Closed

TypeError: Cannot read property 'pathname' of null #13

thomasparsons opened this issue Mar 12, 2018 · 2 comments

Comments

@thomasparsons
Copy link

I get this error TypeError: Cannot read property 'pathname' of null from the most recent version of found-scroll (i'm using "^0.1.2" - and so it's picking up 0.14 I assume)

I get the error when loading the site/hitting refresh

I'm using the same code as the readme:

const shouldUpdateScrollByPathname = (prevRenderArgs, { location }) => (
  prevRenderArgs && location.pathname !== prevRenderArgs.location.pathname
);

and the prevRenderArgs.location is returning null, and so failing when trying to hit pathname

I've temporarily solved this with an additional check of:

prevRenderArgs && prevRenderArgs.location && location.pathname !== prevRenderArgs.location.pathname

which isn't super ideal

@taion
Copy link
Contributor

taion commented Mar 12, 2018

i see, will fix

@taion
Copy link
Contributor

taion commented Mar 13, 2018

Fixed in v0.1.5.

BTW, the example was sort of busted. It should be more like https://github.com/4Catalyzer/found-scroll/pull/14/files#diff-04c6e90faac2675aa89e2176d2eec7d8R52, unless you want the initial scroll restore to not work.

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

No branches or pull requests

2 participants