0

I am on this url in google chrome:

http://mysite:7466/#lessonplanner

then I press F5 to refresh/reload the current site but the content is not reshown. I see an empty page.

In the console I see: Route not found

This is how my route is setup:

 router.map([
{ route: 'lessonplanner', moduleId: 'viewmodels/lessonplanner', title: 'lesson planner', nav: true }])
                 .buildNavigationModel();

What do I wrong?

Elisabeth
  • 20,496
  • 52
  • 200
  • 321
  • 1
    Hard to to tell. My guess it that the route is defined in a place that is not hit when you load `#lessonplaner` directly. Try moving it up the stack. – RainerAtSpirit Oct 04 '13 at 17:32
  • You are right, this route #lessonplanner is only loaded when a schoolyear record is loaded before where this lessonplanner belongs to... Hitting F5 is executing the whole shell.js and behaving as the schoolyear was never loaded before therefore the 'route not found'... What would you suggest now? Hm actually the user expects to just reload the lessonplanner, that means I have to persist the loaded schoolyearId to the localStorage. ok this is an edge case I have to deal later when I do the login... Thanks for the hint Rainer. – Elisabeth Oct 04 '13 at 18:52
  • If you are building a single page application with Durandal one would expect to not have to have to reload the page with F5 unless there is a REALLY good reason, but I have never heard of it if there is... – PW Kad Oct 04 '13 at 20:01
  • @PW Kad. Sure there is one. Deep linking e.g. `#/categoryId/productId` should resolve if people hit it directly. So in `activate` there must be a way to retrieve the data based on `categoryId` and `productId` because at this time this is the only information you have. – RainerAtSpirit Oct 04 '13 at 21:00
  • @PWKad You have a technical point of view. From a user perspective F5 should always refresh a website. – Elisabeth Oct 06 '13 at 09:28
  • @Elisa My comment was that from a design perspective one should never HAVE to hit F5 to refresh the page. – PW Kad Oct 06 '13 at 15:04
  • @PW Kad then we must ask for the root cause why F5 exists at all. Sometimes when a browser loads data it hangs. For this you have the 'try it again' button. This is a feature to the user he can use if something went wrong :) – Elisabeth Oct 09 '13 at 18:47

1 Answers1

0

This is a classic example where i would split the lessionplanner into a module and include it in the view with the core data in it. Then the actual view is reloaded which will work if it is linked properly.

  • I am not sure wether I understood your answer correctly. Or wether you understood my scenario because my lessionplanner is already a module. I can not load the lessonplanner with the core data because a lessonplanner relates to a schoolyear which must be loaded before. Actually the route should be like this: localhost:80/schoolyear/09-13-2013/lessonplanner. But I still have to implement that deep linking. – Elisabeth Oct 09 '13 at 18:50