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

NextJs 14 className hydration bug. #2498

Open
5 of 30 tasks
nandy1990 opened this issue Sep 26, 2024 · 1 comment · May be fixed by #2522
Open
5 of 30 tasks

NextJs 14 className hydration bug. #2498

nandy1990 opened this issue Sep 26, 2024 · 1 comment · May be fixed by #2522
Labels
🐛 bug Something isn't working

Comments

@nandy1990
Copy link

Package

  • lucide
  • lucide-angular
  • lucide-flutter
  • lucide-preact
  • lucide-react
  • lucide-react-native
  • lucide-solid
  • lucide-svelte
  • lucide-vue
  • lucide-vue-next
  • Figma plugin
  • source/main
  • other/not relevant

Version

0.446.0

Can you reproduce this in the latest version?

  • Yes
  • No

Browser

  • Chrome/Chromium
  • Firefox
  • Safari
  • Edge
  • iOS Safari
  • Opera
  • Other/not relevant

Operating system

  • Windows
  • Linux
  • macOS
  • ChromeOS
  • iOS
  • Android
  • Other/not relevant

Description

When using "use client" className differs by trailing whitespace between server and client.
Inside off createLucideIcon.js className gets joined together by following line 23:

className: ["lucide", lucide-${toKebabCase(iconName)}, className].join(" ")

so if className is empty you end up having a trailing space.

Console output in browser:

Warning: Prop className did not match. Server: "lucide lucide-euro " Client: "lucide lucide-euro"
at svg...

Steps to reproduce

Any file with "use client" and rendering any icon without className specified leads to this warning/error

Checklist

  • I have searched if someone has submitted a similar issue before and there weren't any. (Please make sure to also search closed issues, as this issue might already have been resolved.)
@nandy1990 nandy1990 added the 🐛 bug Something isn't working label Sep 26, 2024
@bsimpson888
Copy link

Hello together, I face exactly the same bug.
By trimming the resulting className string, the error is gone.
Could someone please add the .trim() after the .join(" ") to this line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants