I'm curious how people deal with a situation like this. I have an application that at a route like "/categories" displays a list of categories. When each category is clicked on, a list of products in that category appears, and the route updates to something like "/categories/1/products". If I navigate some and then click the back button, I should be able to just render the products list view for the previous category, without re-rendering the categories view.
However, I also need to ensure that when I navigate directly to "/categories/2/products" the categories list as well as the products list is rendered.
Basically, it means the router would have to respond differently to back/forward history navigation than to accessing a URL directly. Is there a common solution to this type of problem?