Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Use a new RouterBuilder API for routes.tsx (#19020)
Removes the buildRoutes method and replaces it with a new RouterBuilder API that automatically injects server side routes where needed and adds the auth level. Related-to vaadin/hilla#2238 Fixes #18988
- Loading branch information
Showing
11 changed files
with
336 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
flow-server/src/main/resources/com/vaadin/flow/server/frontend/routes-flow.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/****************************************************************************** | ||
* This file is auto-generated by Vaadin. | ||
* It configures React Router automatically by adding server-side (Flow) routes, | ||
* which is enough for Vaadin Flow applications. | ||
* Once any `.tsx` or `.jsx` React routes are added into | ||
* `src/main/frontend/views/` directory, this route configuration is | ||
* re-generated automatically by Vaadin. | ||
******************************************************************************/ | ||
import { createBrowserRouter, RouteObject } from 'react-router-dom'; | ||
import { serverSideRoutes } from 'Frontend/generated/flow/Flow'; | ||
|
||
function build() { | ||
const routes = [...serverSideRoutes] as RouteObject[]; | ||
return { | ||
router: createBrowserRouter(routes), | ||
routes | ||
}; | ||
} | ||
export const { router, routes } = build() |
Oops, something went wrong.