New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: show available client routes #19050
Conversation
@@ -79,7 +82,7 @@ public int setRouteNotFoundErrorParameter(BeforeEnterEvent event, | |||
boolean productionMode = event.getUI().getSession().getConfiguration() | |||
.isProductionMode(); | |||
String template; | |||
String routes = getRoutes(event); | |||
String routes = getServerRoutes(event); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not use only server routes in the end. The logic below requires routes not to be empty if there are server or client views
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, looks like I forgot to rename getServerRoutes back to getRoutes.
dfea9eb
to
dfc1f5d
Compare
dfc1f5d
to
e9378c4
Compare
Does and should |
It's meant for both. So far I've tested it with Hilla by letting I noticed that $index.tsx and $layout.tsx are still listed. $layout.tsx should be always hidden as it's not a real path afaik, but $index.tsx path should show up to cover up cases when it's in other places than root. |
There was discussion in Flow daily meeting about the Spring security to be taken in account with this, but as |
default List<String> getClientRoutes() { | ||
return List.of(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This perhaps shouldn't have a default method and instead require that it is always implemented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, no need for the default impl anymore. It was there for a reason first.
flow-server/src/main/java/com/vaadin/flow/server/frontend/FrontendUtils.java
Show resolved
Hide resolved
flow-server/src/main/java/com/vaadin/flow/router/AbstractRouteNotFoundError.java
Show resolved
Hide resolved
Adds client views in the list of available routes when viewing "Route not found" page in development mode. Adds ClientRoutesProvider interface to get available client routes. Client routes means mainly Hilla views, but not limited to. Fixes: #18857
Can't use @ConditionalOnMissingBean as the bean from Hilla dependencies is not reached from here leading to multiple beans which will break things. Therefore, allowing just one implementation of ClientRoutesProvider when Hilla is in the classpath.
ba837df
to
3e31550
Compare
Quality Gate passedIssues Measures |
This ticket/PR has been released with Vaadin 24.4.0.alpha19 and is also targeting the upcoming stable 24.4.0 version. |
Adds client views in the list of available routes when viewing "Route not found" page in development mode. Adds ClientRoutesProvider interface to get available client routes. Client routes means mainly Hilla views, but not limited to.
Fixes: #18857