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

fix: Check main layout presence separately (#2831)(CP: main) #2836

Merged
merged 1 commit into from
Oct 15, 2024

Conversation

mshabarov
Copy link
Contributor

@mshabarov mshabarov commented Oct 15, 2024

Description

MenuRegistry::collectClientViews erases/overrides the layout entry by the view entry, if they have the same mapping, e.g. when you add @layout.tsx and @index.tsx in the same folder.

Thus, the ServerAndClientViewsProvider::hasMainMenu method may not get all the layouts in the input collection.

That leads to hasMainMenu=false and to skipping menu entries for Flow routes.

This patch uses vaadin/flow#20245 new method to detect top-level main layout that fulfils the same criteria: empty route, non-null children, no other root elements.

Related-to #2825

Type of change

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

Additional for Feature type of change

  • Enhancement / new feature was discussed in a corresponding GitHub issue and Acceptance Criteria were created.

* fix: Check the whole file routes file for main layouts

* change method name, add a test

---------

Co-authored-by: Zhe Sun <[email protected]>
@mshabarov mshabarov changed the title fix: Check main layout presence separately (#2831) fix: Check main layout presence separately (#2831)(CP: main) Oct 15, 2024
Copy link

Copy link

codecov bot commented Oct 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.49%. Comparing base (d9ac5cf) to head (ba86b88).
Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2836   +/-   ##
=======================================
  Coverage   92.49%   92.49%           
=======================================
  Files          83       83           
  Lines        2771     2771           
  Branches      717      717           
=======================================
  Hits         2563     2563           
  Misses        156      156           
  Partials       52       52           
Flag Coverage Δ
unittests 92.49% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@taefi taefi left a comment

Choose a reason for hiding this comment

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

LGTM.
There is only a consideration about using the already existing deploymentConfiguration instance in ServerAndClientViewsProvider instead of getting it from the VaadinService (from request). This is discussed with @mshabarov already, and since the original PR has been merged, this can also be merged, so that the subsequent PR fixing this can also be CPed automatically.

@taefi taefi merged commit 0daf4dc into main Oct 15, 2024
15 checks passed
@taefi taefi deleted the has-main-menu-cp branch October 15, 2024 13:49
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Hilla 24.6.0.alpha1 and is also targeting the upcoming stable 24.6.0 version.

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.

3 participants