yester icon indicating copy to clipboard operation
yester copied to clipboard

Fallthrough Routes

Open mattoni opened this issue 8 years ago • 2 comments

@basarat

I've been running yester in production for several months now, working great. However I've run into a particular case multiple times and wonder if you have any thoughts on this:

I want to be able to have routes that fall through, i.e. they match multiple, nested routes. For example: /test/* and /test/test2 would match both routes, and if i were to go to /test/test3 the beforeUnload would only be called on the /test/test2 route (since we haven't left /test/*). This would allow me to handle repetitive data loading tasks without doing it multiple times, nest route views, etc.

What are your thoughts?

mattoni avatar Jun 21 '17 02:06 mattoni

I also noticed that having a route like /test/* and going to /test/test1/ does not give me any remaining path, which leads to other complications. Is this on purpose?

mattoni avatar Jun 21 '17 02:06 mattoni

This would allow me to handle repetitive data loading tasks without doing it multiple times, nest route views, etc.

You can simply move out the functions and call them as needed. Pseudo logic:

  • child:
    • parentLeave(); childLeave();
  • parent :
    • parentLeave();

basarat avatar Jun 21 '17 03:06 basarat