visionmedia / page.js

Micro client-side router inspired by the Express router
http://visionmedia.github.com/page.js
7.67k stars 687 forks source link

Properly checking the pageWindow object before pointing to an attribute #464

Closed mousavian closed 6 years ago

mousavian commented 6 years ago

I have noticed in some cases the getBase function is throwing an error because pageWindow is not properly checked.

So this PR is addressing this issue to resolve Cannot read property 'location' of undefined error.

It would be great if someone can do more investigation of why in some cases pageWindow become undefined in the first place.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 91.429% when pulling a1f9d32d2a1f7f10f4ad84dab4a15fae166e3d2f on mousavian:master into 7fd65848cc5bc3b471d95ee51b80a7a1e1e24938 on visionmedia:master.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 91.429% when pulling a1f9d32d2a1f7f10f4ad84dab4a15fae166e3d2f on mousavian:master into 7fd65848cc5bc3b471d95ee51b80a7a1e1e24938 on visionmedia:master.

mousavian commented 6 years ago

Hey mate @matthewp, thanks for merging it in. Any estimation on when this will be published & available in npm? Regards

rkyoku commented 6 years ago

I had the same error just now, but I quickly found out that was because I did not call page({click: false}); after defining all my routes. I did not notice the page() call in the doc after all the routes, my bad!

Maybe put that extra line of code inside another dedicated blockquote to really insist on it?

Dunno if this was @mousavian request, but thought I could share my experience on this.

Cheers,