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

fix: add unique keys to iconNode and children to resolve React errors #2655

Closed
wants to merge 4 commits into from

Conversation

hypervisor
Copy link

What is the purpose of this pull request?

  • New Icon
  • Bug fix
  • New Feature
  • Documentation update
  • Other:

Description

This PR resolves the missing key warnings in the Icon component by adding unique key props to the elements created from iconNode and children.

Closes #2654

Before Submitting

packages/lucide-react/src/Icon.ts Outdated Show resolved Hide resolved
hypervisor and others added 2 commits December 18, 2024 18:16
Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
@hypervisor
Copy link
Author

@ericfennis Good catch, I applied your suggested changes

Copy link
Member

@jguddas jguddas left a comment

Choose a reason for hiding this comment

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

I don't think that's a good idea, using indexes as keys is not something we should do.

@ericfennis
Copy link
Member

@jguddas This is only when custom icons are added. The icon nodes we provide have random keys generated based on the content.

@jguddas
Copy link
Member

jguddas commented Dec 20, 2024

My opinion stays the same, we should not do this. If you want to fix the error add keys to your custom icon data, https://lucide-studio.vercel.app does it automatically already.

Copy link

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Jan 20, 2025
@jguddas jguddas closed this Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

createLucideIcon causes missing key error in React
3 participants