and then add something like this to your Lovelace config:
preload:
- markdown
- gauge
This will preload those cards on reload of the page.
This is useful in the following cases:
Custom cards which have not been updated for 0.107
Using the standard cards as rows within an entities card by using the “custom:hui-cardname-card” trick
One limitation of this is that it works by creating a temporary instance of the cards it is preloading and these won’t have a valid configuration. This means you will see errors like the following in the browser console (example for the markdown card):
A second change that was made, is that we no longer load all element types by default. We load them when they are needed. This will also help performance but might break your custom card.
This affects custom cards which load standard cards but also affects using the use of standard cards as entity rows via “custom:hui-cardname-card” - there was an issue posted regarding this (now closed):
I actually based my code on the suggested workaround posted in that issue.
It won’t work for cards like that, since that appears to be affected by the change introduced in 0.106 where the card config is read-only (errors like “Cannot assign to read only property”). I don’t think this issue can be fixed without changes to the cards themselves.
Lovelace Card Preloader is designed for the changes in 0.107 (originally planned for 0.106) where the standard cards are only loaded when needed. For example, if you have something like this:
In 0.107 this may result in an error like “Custom element doesn’t exist: hui-conditional-card”.
With the Lovelace Card Preloader installed, this can be fixed by adding
preload:
- conditional
which will preload the conditional card when the page loads
The workaround by balloob would need the JavaScript to be updated if you want to add a new card to preload (which also means you need to deal with caching). Mine is actually based on that code, but picks the cards up from the Lovelace configuration so you can more easily add cards (particularly if you use storage mode for Lovelace).
I just tried it and it worked for me without any warning on HACS 0.23 (I was previously on HACS 0.22.3 and I believe it was working on that as well). Double check that you are adding the correct URL, since the only way I got a warning to appear was when I accidentally put in the URL of a repository which was already there as a default repository).
I’ve just been able to reproduce the issue. Try re-adding the repo without the forward slash on the end of the URL, it looks like that confuses the GitHub API.
I don’t think i ever had to worry about removing that before. I just copied whatever the address was that was in the address bar and it always worked.
ERROR (MainThread) [frontend.js.latest.202001303] https://<redacted>.duckdns.org/hacsfiles/lovelace-card-preloader/lovelace-card-preloader.js:1:1056 TypeError: window.loadCardHelpers is not a function
That’s odd, that should still work in 0.106 - I tested it successfully myself on 0.106.6.
The only difference I’ve noticed between running this in 0.106 and 0.107 is that some cards (such as markdown) don’t give the config errors in 0.107 as they do in 0.106 (presumably a default config is being used for those cards in 0.107) but everything else seems identical.