Closed michaelhthomas closed 2 years ago
Hey there @michaelhthomas 👋
This is an highly unlikely scenario. When loading the hass frontend, at first all the internal cards get loaded. After that custom cards get loaded. That means by the time a custom card gets called upon which uses this library, all internal cards are already loaded.
I agree though that we should check for the functions existance first. Thanks for bringing this up!
Take Care and stay safe!
Thank you! Somehow, one of my custom cards seemed to be calling createThing before hui-error-card was initialized. Not sure how, but I could typically replicate it by force reloading the page. Subsequent reloads worked just fine most of the time.
The question is what the wanted behaviour would be... if it throws an error,the console will get spammed and it eventually won't render at all, If it just returns there is no way to know for the developer what actually happened. Let me know what you think!
When calling
createThing
beforehui-error-card
has been initialized, there is the potential for infinite recursion. When a component'ssetConfig
method is not yet defined,createThing
attempts to create an error card:If
hui-error-card
is not yet loaded, thesetConfig
method does not exist on the error card, causing infinite recursion.