Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

Cannot read property 'x' of undefined #25

Closed
cmalven opened this issue Feb 27, 2018 · 1 comment
Closed

Cannot read property 'x' of undefined #25

cmalven opened this issue Feb 27, 2018 · 1 comment

Comments

@cmalven
Copy link

cmalven commented Feb 27, 2018

I've built a few sites using roadtrip, and there's an infrequent bug I've been noticing when navigating between routes:

Uncaught TypeError: Cannot read property 'x' of undefined

Here's the roadtrip code related to the error (though I imagine you can guess what it is):

_target = {
  href: location$1.href,
  scrollX: scroll.x, // <--- the source of the error
  scrollY: scroll.y,
  popstate: true, // so we know not to manipulate the history
  fulfil: noop,
  reject: noop
};

Steps to reproduce

  • Open a page powered by roadtrip
  • Navigate to any route
  • Click the browser back button in the browser UI to return to the previous route
  • Refresh the page using the browser UI
  • Press the forward button in the browser UI to return to the previous route

I believe what is likely happening here is that refreshing the page clears road trip's scrollHistory, but roadtrip doesn't have a fallback for when a matching entry in the scroll history doesn't exist. Maybe?

Kiho pushed a commit to Kiho/roadtrip that referenced this issue Feb 9, 2019
@Kiho
Copy link
Collaborator

Kiho commented Feb 9, 2019

Hi @mrkishi,
Can you merge my PR and bump-up version in NPM?

Kiho added a commit that referenced this issue Apr 28, 2019
Fix - Cannot read property 'x' of undefined #25
@Kiho Kiho closed this as completed May 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants