Skip to content

[bug]: fatal server error in nextjs, thrown by post-main-navigation #6691

@oliverschuerch

Description

@oliverschuerch

🐞 Describe the bug

There is a new fatal error on the server in the NextJS environment of the POW team.
They traced it back the rabbit hole and sent us the following information:

"It is due to the fact, that the post-main-navigation component assumes that an animation object is always present when closing the mobile menu.
When the menu is closed before any animation is created (e.g. during SSR hydration), calling closeMobileMenu throws because it tries to access .finish() on undefined."

As far as I could see, this is not exclusively coming from post-main-navigation, but also is an issue in the post-collapsible component (see error message below).

🛠️ To Reproduce

See the logs for the swisspost/pow-cargo project.

✨ Expected behavior

post-main-navigation does not throw if closeMobileMenu is undefined because its existance/definition is checked, before the execution of any animation related function is performed.

📷 Screenshots

*PostCollapsible"
Image

Metadata

Metadata

Labels

requestThis is a request from a contributor outside of the core team.🐞 bugSomething isn't working

Type

Projects

Status

💻 In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions