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

feat: add collectMenuItemsList() to MenuRegistry #19952

Merged
merged 4 commits into from
Sep 16, 2024

Conversation

tltv
Copy link
Member

@tltv tltv commented Sep 13, 2024

fixes: #19905

value.register(), value.menu(), value.children(),
value.routeParameters(), value.flowLayout());
}).sorted(getMenuOrderComparator(
Collator.getInstance(Locale.forLanguageTag("en-US")))).toList();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be a problem with GraalVM and their idea to have as small as possible executables.. Collator.getInstance() might be more random.. but probably safer

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I understanding this right that you mean that usage of Collator instance for en-US could increase memory consumption compared to just using the default provided with Collator.getInstance()?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, because GraalVM only includes locales / languages that are required by the application - if the application is e.g. completely in german, the above language might not be available - or GraalVM adds it if needed (this part I'm not sure.. I just remember seeing issues regarding this topic in the past)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

en-US matches with how Hilla is doing it in Typescript here

We should sort same way in both places and currently it's hard coded in Hilla. If this causes trouble, it can be avoided by adding optional Locale parameter in the API. Default can be en-US. I'll add another method collectMenuItemsList(Locale).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just FYI where my concern comes from:

It is also possible to specify which locales should be included in the executable and which should be the default. For example, to switch the default locale to Swiss German and also include French and English, use the following options:

native-image -Duser.country=CH -Duser.language=de -H:IncludeLocales=fr,en

The locales are specified using language tags. You can include all locales via -H:+IncludeAllLocales, but note that it increases the size of the resulting executable.

https://www.graalvm.org/latest/reference-manual/native-image/dynamic-features/Resources/#locales

Copy link

github-actions bot commented Sep 13, 2024

Test Results

1 135 files  ± 0  1 135 suites  ±0   1h 27m 36s ⏱️ + 3m 47s
7 394 tests + 2  7 344 ✅ + 2  50 💤 ±0  0 ❌ ±0 
7 731 runs   - 20  7 671 ✅  - 20  60 💤 ±0  0 ❌ ±0 

Results for commit 0788738. ± Comparison against base commit 5feb94b.

This pull request removes 1 and adds 3 tests. Note that renamed tests count towards both.
com.vaadin.flow.server.menu.MenuRegistryTest ‑ collectMenuItems_returnsCorrecPaths
com.vaadin.flow.server.menu.MenuRegistryTest ‑ collectMenuItems_returnsCorrectPaths
com.vaadin.flow.server.menu.MenuRegistryTest ‑ getMenuItemsList_assertOrder
com.vaadin.flow.server.menu.MenuRegistryTest ‑ getMenuItemsList_returnsCorrectPaths

♻️ This comment has been updated with latest results.

Copy link

@mshabarov mshabarov merged commit 7b9057e into main Sep 16, 2024
26 checks passed
@mshabarov mshabarov deleted the feat/19905-menuregistry-list branch September 16, 2024 11:09
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 24.5.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MenuRegistry should have method to get List of ordered menu items
5 participants