lucide
lucide copied to clipboard
Hide error message "Name in Lucide DynamicIcon not found" for DynamicIcon when a valid fallback component is present
Package
- [ ] lucide
- [ ] lucide-angular
- [ ] lucide-flutter
- [ ] lucide-preact
- [x] 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
- [x] I have searched the existing issues to make sure this bug has not already been reported.