-
Notifications
You must be signed in to change notification settings - Fork 57
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(file-router): add RouterBuilder class #2250
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2250 +/- ##
==========================================
+ Coverage 93.79% 95.35% +1.55%
==========================================
Files 66 67 +1
Lines 1644 4431 +2787
Branches 370 630 +260
==========================================
+ Hits 1542 4225 +2683
- Misses 67 163 +96
- Partials 35 43 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Flow counterpart is here vaadin/flow#19020. |
Is the API in this PR going to be changed according to #2238 ? |
Yes. |
# Conflicts: # .mocharc.cjs # package-lock.json # packages/ts/file-router/package.json # packages/ts/file-router/src/runtime/RouterBuilder.ts # packages/ts/file-router/src/shared/traverse.ts # packages/ts/file-router/test/runtime/RouterBuilder.spec.tsx
Tested this branch with hybrid starter got the following problems:
|
Also, the routes in |
It should be in another PR, I guess.
Oops, my bad. Fixed
That's could probably be solved by fixing two previous points.
Well... How it is supposed to be used? |
Tested again with the Flow-Hilla starter and with the latest changes in this PR:
import Flow from 'Frontend/generated/flow/Flow';
import { serverSideRoutes } from 'Frontend/generated/flow/Flow';
import fileRoutes from 'Frontend/generated/views';
import Login from "Frontend/views/login";
import {RouterBuilder} from "@vaadin/hilla-file-router/runtime.js";
const routerBuilder = new RouterBuilder()
.withFileRoutes(fileRoutes)
.withReactRoutes(
{ path: '/login', element: <Login />, handle: { title: 'Login' } },
)
.withServerRoutes(Flow)
.protect('/login');
export const routes = routerBuilder.routes;
export default routerBuilder.build();
If I Also, navigating to |
Noticed that if I change routes config to
then wherever I navigate ( |
And this issue with ViewConfig #2276 is observable for this PR as well. |
Have you tested it with the hybrid example? I get the same issues (blank root page localhost:8080/ and no main layout) with:
|
Here is my routes config: import Flow from 'Frontend/generated/flow/Flow';
import fileRoutes from 'Frontend/generated/views';
import Login from "Frontend/views/login";
import {RouterConfigurationBuilder} from "@vaadin/hilla-file-router/runtime.js";
export const { routes, router} = new RouterConfigurationBuilder()
.withFileRoutes(fileRoutes)
.withReactRoutes(
{ path: '/login', element: <Login />, handle: { title: 'Login' } }
)
.withFallback(Flow)
.protect('/login')
.build(); |
My bad. The latest version uses But now the Flow view is shown with the Public view content. |
This is how it looks like: Screen.Recording.2024-04-04.at.17.08.20.mov |
# Conflicts: # packages/ts/file-router/package.json
…ing adding fallback
packages/ts/file-router/test/vite-plugin/createViewConfigJson.spec.ts
Outdated
Show resolved
Hide resolved
|
Fixes #2238