Closed adrianncovaci closed 9 months ago
This seems like a bug. Can you please provide the relevant part of the component that produces this warning, and specify the version of this library and the version of leptos
you are using.
FYI: The inputs to the Icon
component are already all of type MaybeSignal<T>
so the library should already be able to handle signals (I think).
I've been using the lates leptos version (0.5.0-rc3) and the main branch for leptos-icons, however I think this issue occurs on previous leptos version as well due to the fact that the get
method was used outside of a closure inside the component's body, here. I've prepared a pr which fixes this.
I will publish version 0.0.16-rc3
, and the bug should be fixed
When attempting to reactively update an icon using a signal like:
<Icon icon=icon_signal class="h-6 w-6 text-gray-400"/>
, I encountered the warning:Signal or memo accessed outside a reactive tracking context (defined at /rustc/ad963232d9b987d66a6f8e6ec4141f672b8b9900/library/core/src/convert/mod.rs:716:9) on the line let icon: IconData = icon.get().into();
in lib.rs.Wouldn't it be more appropriate to handle the signal inside the Icon component so that it'll react on change (for example, if modifying the icon from another component). This is what I had in mind: