Skip to content

Commit

Permalink
fix: Unify client route to match server route format (#19742) (CP: 24…
Browse files Browse the repository at this point in the history
….4) (#19744)

* fix: Unify client route to match server route format (#19742)

Make the client route string
on the error page in dev mode
not start with / so it is the
same as for server-side routes.

Fixes #19182

* fix test expectation

---------

Co-authored-by: caalador <[email protected]>
Co-authored-by: Mikael Grankvist <[email protected]>
  • Loading branch information
3 people authored Aug 6, 2024
1 parent 5c077f7 commit 01053c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ private Element clientRouteToHtml(String route) {
if (text.isEmpty()) {
text = "<root>";
}
if (text.startsWith("/")) {
text = text.substring(1);
}
if (!route.contains(":")) {
return elementAsLink(route, text);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ public void assertClientRoutesRegistered() {
if (getDriver().getPageSource().contains(
"This detailed message is only shown when running in development mode.")) {
var expectedClientRoutes = List.of("<a href=\"\">&lt;root&gt;</a>",
"<a href=\"/hilla\">/hilla</a>",
"<li>/hilla/person/:id (requires parameter)</li>",
"<li>/hilla/persons/:id? (supports optional parameter)</li>",
"<a href=\"/hilla/hilla/\">/hilla/hilla/</a>",
"<a href=\"/anotherhilla\">/anotherhilla</a>");
"<a href=\"/hilla\">hilla</a>",
"<li>hilla/person/:id (requires parameter)</li>",
"<li>hilla/persons/:id? (supports optional parameter)</li>",
"<a href=\"/hilla/hilla/\">hilla/hilla/</a>",
"<a href=\"/anotherhilla\">anotherhilla</a>");
for (String route : expectedClientRoutes) {
Assert.assertTrue(
String.format("Expected client route %s is missing",
Expand Down

0 comments on commit 01053c3

Please sign in to comment.