createMenuItems() and custom routers.tsx

hi, so I’m generating the menu items in the layout as suggested in the documentation as follows:

<SideNav onNavigate={({path}) => navigate(path!)} location={location}>
                        {createMenuItems().map(({to, title, icon}) => (
                            <SideNavItem path={to} key={to}>
                                {icon && (<Icon icon={icon} slot="prefix"/>)}
                                {title}
                            </SideNavItem>
                        ))}
                    </SideNav>

this worked so far, but I want to add spring security and so as suggested by the doc I’ve created a custom routes.tsx:

import MainLayout from './views/@layout';
import LegacyImport from "./views/LegacyImport";
import LoginView from './views/login';
import CI_View from './views/CI_View';
import {RouterConfigurationBuilder} from "@vaadin/hilla-file-router/runtime.js";


export const {router, routes} = new RouterConfigurationBuilder()
    .withReactRoutes(
        [
            {
                element: <MainLayout/>,
                handle: {title: 'OPF'},
                children: [
                    {path: '/legacy', element: <LegacyImport/>, handle: {title: 'Legacy Import', requiresLogin: true, rolesAllowed: ['OPFCCADMIN']}},
                    {path: '/', element: <CI_View/>, handle: {title: 'Configuration Items', requiresLogin: true}},
                ],
            },
            {path: '/login', element: <LoginView/>},
        ]
    )
    //  path to redirect to, if not authenticated:
    .protect('/login')
    .build();

the routes file itself seems to work, but the generated menu seems to use the file based router instead, and not the entries specified here, ignoring for example the roles. Is this expected? Do I need to build the menu` manually or can it be inferred by the routes.tsx as before?

thank you

Spring Security works automatically also with the automatic routes based on files in /views. Shouldn’t be any need to customize routes.tsx for that. It seems like we missed to update some of the existing documentation when we added support for automatic routes.