Skip to content

Conversation

@oliverschuerch
Copy link
Contributor

📄 Description

  • Implements an optional chaining operator in the post-header, so we don't call accidentally the finish function on a not defind animation object.
  • Implements SSR specific guards in the post-collapsible component, so we can't accidentally execute the following logics:
    • Toggling a collapsible does not make any sense on the server.
    • Updating post-collapsible-trigger attributes from post-collapsible is impossible.
  • Refactors the post-collapsible toggle function, by improving the behavior when user perfers reduced motion.

🚀 Demo

If applicable, please add a screenshot or video to illustrate the changes.


🔮 Design review

  • No design review needed

📝 Checklist

  • ✅ My code follows the style guidelines of this project
  • 🛠️ I have performed a self-review of my own code
  • 📄 I have made corresponding changes to the documentation
  • ⚠️ My changes generate no new warnings or errors
  • 🧪 I have added tests that prove my fix is effective or that my feature works
  • ✔️ New and existing unit tests pass locally with my changes

…e finish function of the burgerMenuAnimation in the post-header component
…ards in functions which are not ssr compatible
@changeset-bot
Copy link

changeset-bot bot commented Nov 19, 2025

🦋 Changeset detected

Latest commit: 3fc72b9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 14 packages
Name Type
@swisspost/design-system-components Patch
@swisspost/design-system-components-angular-workspace Patch
@swisspost/design-system-components-react Patch
@swisspost/design-system-documentation Patch
@swisspost/design-system-nextjs-integration Patch
@swisspost/design-system-components-angular Patch
@swisspost/design-system-changelog-github Patch
@swisspost/design-system-eslint Patch
@swisspost/design-system-icons Patch
@swisspost/internet-header Patch
@swisspost/design-system-styles Patch
@swisspost/design-system-styles-primeng-workspace Patch
@swisspost/design-system-styles-primeng Patch
@swisspost/design-system-tokens Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@swisspost-bot
Copy link
Contributor

swisspost-bot commented Nov 19, 2025

Related Previews

@oliverschuerch oliverschuerch force-pushed the fix/6691-bug-fatal-server-error-in-nextjs-thrown-by-post-main-navigation branch from 0adf67f to c56572b Compare November 19, 2025 15:35
if (!this.isLoaded || isMotionReduced()) animation.finish();

await animation.finished;
if (animation && animation.finished) {
Copy link
Contributor

Choose a reason for hiding this comment

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

animation is now always defined

Copy link
Contributor Author

@oliverschuerch oliverschuerch Nov 25, 2025

Choose a reason for hiding this comment

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

Sadly it's not during server side rendering.

Stencils hydrate app is mocking a lot of browser specific things (e.g. window, etc.), so it is able to pre-render the components on the server.
But it it not mocking the HTMLElement Animation API.
And adding a IS_SERVER guard did not help at all.

I'm still trying to figure out how we can detect that, because const IS_SERVER = typeof window === 'undefined'; does not work, since we updated some packages to their latest versions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Instead of checking the animation, I fixed the IS_BROWSER and IS_SERVER utility flags (it only took me 2 days 😢) and used them in the component. This way it's clearer for devs, why this check is necessary.

@gfellerph gfellerph removed their request for review November 24, 2025 15:51
@leagrdv leagrdv removed their request for review November 26, 2025 06:22
@oliverschuerch oliverschuerch force-pushed the fix/6691-bug-fatal-server-error-in-nextjs-thrown-by-post-main-navigation branch 3 times, most recently from c3f03fb to 0330c02 Compare November 28, 2025 15:11
@oliverschuerch oliverschuerch force-pushed the fix/6691-bug-fatal-server-error-in-nextjs-thrown-by-post-main-navigation branch from 0330c02 to 96b0c66 Compare November 28, 2025 15:17
…rown-by-post-main-navigation

# Conflicts:
#	packages/components/src/components.d.ts
@sonarqubecloud
Copy link

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

4 participants