Skip to content

SSR: DBNavigationItem always renders with Submenu #4003

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

Open
1 of 7 tasks
milan-w opened this issue Apr 2, 2025 · 1 comment
Open
1 of 7 tasks

SSR: DBNavigationItem always renders with Submenu #4003

milan-w opened this issue Apr 2, 2025 · 1 comment
Labels

Comments

@milan-w
Copy link

milan-w commented Apr 2, 2025

Which generators are impacted?

  • All
  • HTML
  • React
  • Angular
  • Vue
  • Web components
  • Power Apps

Reproduction case

When using server side rendering (e.g. next.js) the following code

<DBNavigation>
      <DBNavigationItem>
          <a href="/">Homepage</a>
      </DBNavigationItem>
</DBNavigation>

should render a link inside of an <li> item.

Instead it renders the link inside a element and an empty subnavigation nav.
Image

I suspect this is because in packages/components/src/components/navigation-item/navigation-item.lite.tsx#32 the prop "hasSubNavigation" is set to true by default and only updated onMount. Additionally updateSubNavigationState starts with a check for the existence of "document", which doesn't exist on the server.

This should be corrected by the client side hydration, but because the server rendering injects a subnavigation (with id), the client side updateSubNavigationState checks find a subNavigationSlot and also renders a subnavigation.

Expected Behaviour

DBNavigationItem should not render a subnavigation when none exists 😀

Screenshots

No response

Browser version

None

Add any other context about the problem here.

No response

@mfranzke
Copy link
Collaborator

see also #4018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

2 participants