-
Notifications
You must be signed in to change notification settings - Fork 176
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
feat: Use a new RouterBuilder API for routes.tsx #19020
Conversation
Test Results1 099 files ±0 1 099 suites ±0 1h 29m 41s ⏱️ + 4m 53s Results for commit b668bfd. ± Comparison against base commit 90abc04. This pull request removes 9 and adds 11 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
flow-server/src/main/java/com/vaadin/flow/server/frontend/TaskGenerateReactFiles.java
Outdated
Show resolved
Hide resolved
flow-server/src/main/java/com/vaadin/flow/server/frontend/TaskGenerateReactFiles.java
Outdated
Show resolved
Hide resolved
flow-server/src/test/java/com/vaadin/flow/server/frontend/TaskGenerateReactFilesTest.java
Outdated
Show resolved
Hide resolved
|
Right, this is needed, will change. |
This now checks that routes.tsx has |
Tested with different configurations and routes.tsx content is as expected, also triggers an error if manual changes are incorrect. |
flow-server/src/main/resources/com/vaadin/flow/server/frontend/routes.tsx
Outdated
Show resolved
Hide resolved
flow-server/src/main/resources/com/vaadin/flow/server/frontend/routes.tsx
Outdated
Show resolved
Hide resolved
# Conflicts: # flow-server/src/main/resources/com/vaadin/flow/server/frontend/Flow.tsx
…route-builder-api
flow-server/src/main/resources/com/vaadin/flow/server/frontend/routes.tsx
Show resolved
Hide resolved
|
I don't see this error, when logged in. This looks as something related to the LoginOverlay component. UPD: This might be related to |
Not a cache issue as I get same error with Edge/Firefox. Yeah AuthContext is not setup for some reason. Maybe I run with old |
Try to clean up the project and re-run. I've just tested with the latest Hilla snapshot. |
@caalador could you please also test? |
@tltv could you please also double check if you have
This is required. |
Ok I didn't use the custom index.tsx. It's not there in the generated index.tsx and somehow I expected it to be correct automatically. After copying default index.tsx and adjusting like that, it works. Shouldn't Flow auto-generate this part too? |
This is problematic, as |
Why don't you use |
And even in the v24.4 branch https://github.com/vaadin/flow-hilla-hybrid-example/blob/v24.4/src/main/frontend/index.tsx. |
I'm testing that generated files works too. |
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.
LGTM. Tested various use cases without facing any problems that require changes necessarily in this PR.
Listing some findings regarding the new API here:
- After removing
.protect()
from theroutes.tsx
, both root path and server routes with@AnonymousAllowed
are available without requiring to log in. No matter what paths they are mapped to. This is also expected so. - Without
.protect()
, all Hilla views are still protected and requires log in. Roles are just ignored. Probably due to the naming I expected all Hilla views to become public. Having protection still enabled is more secure, but is there some way to make client route public explicitly? - Views added with
withReactRoutes()
are not listed in Available routes anymore (they were before builder api). Not registered toClientRouteRegistry
anymore?
These are good comments and something that we should investigate. |
This ticket/PR has been released with Vaadin 24.4.0.alpha21 and is also targeting the upcoming stable 24.4.0 version. |
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