MoOx / pjax

Easily enable fast Ajax navigation on any website (using pushState + xhr)
MIT License
1.46k stars 125 forks source link

this.reload is not a function #65

Closed cj closed 8 years ago

cj commented 8 years ago

When I click a link that I'm already on I get this.reload is not a function https://github.com/MoOx/pjax/blob/546b7e309a8812594edee127eeb48cce0e6a7b88/lib/proto/attach-link.js#L48 I'm using version 0.2.2 via npm

danielfilho commented 8 years ago

got the same problem. should I submit a PR replacing this.reload() for this.location.reload()?

not sure if this is the wanted behaviour for this. but it happens when I click to a / link and I am at /. but even though, in this case, a reload doesn't seem to be the wanted behaviour.

kinda confused on how I can help here :confused:

MoOx commented 8 years ago

Feel free to push any fix.

The idea of reload is that if you are on a page and click on the same page, if we do nothing, UX is going to be weird. That's why I added this behavior in the first place.

danielfilho commented 8 years ago

got it.

I've changed this, but feels weird to do a window.location.reload() on a lib that is supposed to not reload the browser. maybe just a return false or something (which will also feel weird).

I'm really not sure on how should be the behaviour :/

MoOx commented 8 years ago

Default behavior is now back to normal (just pjax, as expected by most people). The option currentUrlFullReload was ignored (regression of the 0.2 release). Things should be ok with 0.2.3