Skip to content
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

[FS-Router] wildcard views are ending up in the automatic menu #3360

Open
taefi opened this issue Mar 18, 2025 · 1 comment
Open

[FS-Router] wildcard views are ending up in the automatic menu #3360

taefi opened this issue Mar 18, 2025 · 1 comment
Labels
bug Something isn't working hilla Issues related to Hilla Impact: High

Comments

@taefi
Copy link
Contributor

taefi commented Mar 18, 2025

Describe the bug

Having a wildcard views like this ends up having them in the auto menu that is created based on the createMenuItems utility from @vaadin/hilla-file-router/runtime.js:

/views
├── +customers
├── /products
│   ├── {id}
│   │   ├── edit.tsx
│   │   └── @index.tsx
│   ├── @index.tsx
│   ├── new.tsx
│   └── {...wildcard}.tsx      <- shows up in the menu
├── @index.tsx
└── {...wildcard}.tsx     <- shows up in the menu

Like this:
Image

Workaround

The wildcard views can be excluded from the menu explicitly using the exported ViewConfig:

import {ViewConfig} from "@vaadin/hilla-file-router/types.js";

export const config: ViewConfig = {
    menu: {
        exclude: true
    }
}

Expected-behavior

Wildcard views should be filtered out automatically by the createMenuItems utility.

Reproduction

You can find the reproducible example here.

System Info

Vaadin: 24.7.0.rc1

@taefi taefi added bug Something isn't working hilla Issues related to Hilla Impact: High labels Mar 18, 2025
@Legioth
Copy link
Member

Legioth commented Mar 18, 2025

The original definition was that routes should be in the automatic menu only if we can generate a sensible URL to that route. That's not the case in this example.

But it would be the case if there would be no @index routes and we change the definition of wildcards to also match with an empty parameter value in case there's no @index. If we implement make that change, then we also need to update the menu generation so that some specific wildcards might end up in the menu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hilla Issues related to Hilla Impact: High
Projects
None yet
Development

No branches or pull requests

2 participants