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

Hide error message "Name in Lucide DynamicIcon not found" for DynamicIcon when a valid fallback component is present #2745

Open
2 of 14 tasks
maurer2 opened this issue Jan 22, 2025 · 0 comments
Labels
💡 idea New ideas

Comments

@maurer2
Copy link

maurer2 commented Jan 22, 2025

Package

  • lucide
  • lucide-angular
  • lucide-flutter
  • lucide-preact
  • lucide-react
  • lucide-react-native
  • lucide-solid
  • lucide-svelte
  • lucide-vue
  • lucide-vue-next
  • Figma plugin
  • all JS packages
  • site

Description

Hello, I've been playing around with the new DynamicIcon component, described here as a replacement for "lucide-react/dynamicIconImports". I noticed that when using an incorrect name prop, the fallback component is rendered instead, but there still the following error message in dev mode: "Name in Lucide DynamicIcon not found". I don't seem to be able to handle that error via an error boundary. Example:

<DynamicIcon name="invalidName" fallback={() => <p>Some fallback content like a default icon</p>} />

Use cases

Hiding the error message or downgrading it to a warning, when there is a valid fallback component, would make working with dynamic icon names via props more pleasant, as showing a fallback component for an icon wouldn't automatically trigger an error.

Checklist

  • I have searched the existing issues to make sure this bug has not already been reported.
@maurer2 maurer2 added the 💡 idea New ideas label Jan 22, 2025
@maurer2 maurer2 changed the title Hide error message for DynamicIcon when a valid fallback component is present Hide error message "Name in Lucide DynamicIcon not found" for DynamicIcon when a valid fallback component is present Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💡 idea New ideas
Projects
None yet
Development

No branches or pull requests

1 participant