Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Stop/Start routing

$
0
0
I have an interesting routing problem.

User is at a URL.
User "logs out" of application. The URL stays but the applications routing instance is destroyed and a login prompt is presented.
User logs back in and the routing controller is re-initialized. I test to see if there is a hash in the URL and try to manually can.route.setState but the rout event is never triggered. If I click to some other URL routing continues to work and all is fine.

setState does a lastHash check to prevent duplicate routes being triggered, but this does not trip (lastHash is null when I debug) and can.route.attr(curParams, true); is executed. I cannot figure out why that initial setState call is ignored.

I tried running can.route.attr({route object}, true}); manually in the console, and it will not trigger a change event for the existing hash. So I guess the question is do I store the hash, change it to nothing and then reset it or is there a more elegant solution?

Viewing all articles
Browse latest Browse all 3491

Trending Articles