olivernn / davis.js

RESTful degradable JavaScript routing using pushState
http://davisjs.com
532 stars 58 forks source link

Route not found causes davis to stop #87

Open bennigraf opened 10 years ago

bennigraf commented 10 years ago

Hi there!

In my very simple application calling a link that has no route defined causes the davis-app to stop. The log says application stopped right before the Route not found message. Clicking on links with registered routes after that generate more Route not found-messages in the log and the actions aren't being called.

I also tried various settings (raiseErrors=false and handleRouteNotFound=false), but that didn't seem to change anything.

Is this intended behaviour?

I'm in Chrome 30.0.1599.101 and using jquery 2.0.3.

jasonlfunk commented 10 years ago

I ran into a similar problem. I believe this is expected because if davis cannot find a link it is going to send it to the server which should cause the page to reload. The problem I ran into was when I submitted a form directly to an iframe (via the target attribute) and so davis assumed the browser was going to refresh - but it didn't - and stopped the app. I simply added a check to my code to see if davis is stopped and restart it.