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

createMenuItems includes parameterized routes #2378

Closed
Tracked by #5012
marcushellberg opened this issue May 1, 2024 · 4 comments · Fixed by #2392
Closed
Tracked by #5012

createMenuItems includes parameterized routes #2378

marcushellberg opened this issue May 1, 2024 · 4 comments · Fixed by #2392
Labels
bug Something isn't working hilla Issues related to Hilla Impact: High Severity: Blocker

Comments

@marcushellberg
Copy link
Member

marcushellberg commented May 1, 2024

Describe the bug

The menu items created by createMenuItems includes paths with parameters, leading to links like users/{id}/edit in the menu
image_720

Expected-behavior

Only paths without parameters are shown

Reproduction

Create the following structure in a Hilla starter users/{id}/edit.tsx

System Info

Hilla 24.4.0.alpha25

@marcushellberg marcushellberg added bug Something isn't working hilla Issues related to Hilla labels May 1, 2024
@Lodin
Copy link
Contributor

Lodin commented May 6, 2024

@Legioth, @platosha, do I understand correctly that we don't want have these items exist in index.html response? I mean, I can remove them on the server level, so the Vaadin.server.views won't have it at all. Or I can filter them on createMenuItems level, keeping them available for the future.

@Legioth
Copy link
Member

Legioth commented May 6, 2024

We are planning to add support for an automatic main menu also for Flow layouts and we wouldn't want to have parameterized Hilla routes in the Flow menu either. From this follows that it would be preferable to filter them out before reaching index.html (i.e. either in Java or the Vite plugin).

@taefi
Copy link
Contributor

taefi commented May 6, 2024

I believe the views with optional parameters should have chance of appearing in the menu. Maybe, the createMenuItems can include them and let the users filter them out on demand?

@Legioth
Copy link
Member

Legioth commented May 6, 2024

Views with optional parameters should be in the menu except if excluded using the regular mechanism. It's only the ones with required parameters that must be left out since we cannot even generate a valid URL to such a view without knowing a parameter value.

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 Severity: Blocker
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants