Normally it’s probably not a good Idea to mix Route Templates and URL Parameters. You Guys probably agree, that’s why the fallowing method does not exist:
public <T, C extends Component & HasUrlParameter<T>> Optional<C> navigate(
Class<? extends C> navigationTarget, RouteParameters parameters, T parameter)
But what to do in the fallowing Scenario?
We have a Layout that uses a @RoutePrefix. This should hold variable information so we use route templates in the prefix. This alone is fine and well supported.
But now, what if a View that uses this Layout itself implements HasUrlParameter? I guess we could also use route template in the @Route of the view, but URL parameters are the preferred way (as stated in the docs).
But now if we want to navigate to this view, its not as trivial. We need to apply the fact, that the URL parameter feature is sort of just syntactical sugar on top of route templates, and add (alongside the parameters from the @RoutePrefix) the URL parameter to the RouteParameters with com.vaadin.flow.router.internal.HasUrlParameterFormat.PARAMETER_NAME
as the key. But this looks not so safe to use (internal package)
Even when navigating between two Views that use the same Layout we need to do this. I would have guessed, that in this case, we can omit the Parameters from the @RoutePrefix and that it would just automatically reuse the same prefix parameters from the current view. This would allow us to use the simpler navigate method. But this does not work.