canjs / can-route

Observable front-end application routing for CanJS.
https://canjs.com/doc/can-route.html
MIT License
10 stars 4 forks source link

Add a warning when route.start is called multiple times #224

Closed chasenlehara closed 5 years ago

chasenlehara commented 5 years ago

done-autorender automatically calls route.start() for you when it sets up your app’s view model. If you follow the can-route docs and call start yourself, your app won’t work because done-autorender will create a new route.data and call route.start() itself.

I think there are a couple possible warnings we could show that would help users understand this issue:

  1. Warn if route.start() gets called a second time without first having been torn down.
  2. Have done-autorender check whether start has already been called, and provide an error/warning if it has.
chasenlehara commented 5 years ago

I’m closing this in favor of https://github.com/canjs/can-route/issues/153