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

🐛 Modal: Fix issue where polyfill-classname was not applied when using SSR (Next.js) #2954

Merged
merged 2 commits into from
May 27, 2024

Conversation

HalvorHaugan
Copy link
Contributor

@HalvorHaugan HalvorHaugan commented May 24, 2024

Feels a bit hacky, but at the same time somewhat elegant since we don't need another useState or something like that. But let me know if you can think of a better way to fix it.

The problem is that needPolyfill is false when the component is rendered on the server. It is correctly set to true when running in the browser, but the className is not actually updated. (You get a warning that the className did not match server etc.)

Copy link

changeset-bot bot commented May 24, 2024

🦋 Changeset detected

Latest commit: 6e143ab

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

This PR includes changesets to release 7 packages
Name Type
@navikt/ds-react Patch
@navikt/ds-css Patch
@navikt/ds-tokens Patch
@navikt/ds-tailwind Patch
@navikt/aksel-icons Patch
@navikt/aksel Patch
@navikt/aksel-stylelint 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

Copy link
Contributor

github-actions bot commented May 24, 2024

Storybook demo

794f1babe | 81 komponenter | 182 stories

@HalvorHaugan HalvorHaugan merged commit 7c339c6 into main May 27, 2024
2 checks passed
@HalvorHaugan HalvorHaugan deleted the modal-polyfill-ssr-fix branch May 27, 2024 09:15
@github-actions github-actions bot mentioned this pull request May 27, 2024
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.

2 participants