vaadin / hilla

Build better business applications, faster. No more juggling REST endpoints or deciphering GraphQL queries. Hilla seamlessly connects Spring Boot and React to accelerate application development.
https://hilla.dev
Apache License 2.0
904 stars 57 forks source link

SideNavItem: allow wildcards in pathAliases #2659

Closed sahrmann closed 1 month ago

sahrmann commented 1 month ago

Describe your motivation

I am using the file-based router which allows wildcards. E.g., I have the following folders/files in my folder views:

So I can access the URL /authors to get a list of all authors and /authors/3 to see the details of an author with id 3. That works fine.

Now I have a SideNav with a parent collapsible SideNavItem Configuration and a child SideNavItem Authors linking to /authors. When I select an author from the list (go to the details page /authors/3), the SideNavItem Authors is not activated anymore, which looks especially weird since the parent item Configuration is collapsed. There is no way to define a wildcard-PathAlias to keep the SideNavItem active.

Describe the solution you'd like

Allow wilcards in the PathAlias like /authors/{id} or /authors/* in the SideNavItem.

Describe alternatives you've considered

Workaround: Create a view authors/detail.tsx and put the id in a query param (/authors/detail?id=3). Then authors/detail can be used as a PathAlias and works. However, considering the design of the file based routing, this does not seem right.

Additional context

No response

knoobie commented 1 month ago

Related to the flow issue https://github.com/vaadin/flow-components/issues/5227

platosha commented 1 month ago

Duplicate of #5227, which is being addressed.