frontend icon indicating copy to clipboard operation
frontend copied to clipboard

Custom Components not loaded (cache issue?)

Open emandtf opened this issue 2 years ago • 4 comments

Checklist

  • [X] I have updated to the latest available Home Assistant version.
  • [X] I have cleared the cache of my browser.
  • [X] I have tried a different browser to see if it is related to my browser.

Describe the issue you are experiencing

If browsers have Cache Disabled all custom components (I'm using vertical-stack-in-card, mini-graph-card and multi-entity-row) won't be recognized until I remove "Disable cache" flag from Development Panel.

Even the FIRST access from a different browser (like on a new device) doesn't recognize custom components even if in the Console Log their initialization seems completed (see attached file). 20231123_console_log Closing and re-opening tab/browser, after this FIRST visit with issues, seems let components working again.

It seems like custom components JS files are loaded just once and then retained in cache and served ONLY from it, so if it is disabled them won't work. I think it's something related to Service Worker and its adavanced caching system.

PS: After this test it was hard to let custom components work again (after cache enabled again) even doing normal page Refresh multiple times. I have to close browser Tab and then open another one to have custom components working again.

Describe the behavior you expected

Clearing browser cache or just do a login from a complete new device and accessing a Dashboard in whic there are some Custom Components present have to work fine without the need to Reload the page many times until them are recognized.

Steps to reproduce the issue

  1. Open Developer Panel (F12 on Firefox and Chrome)
  2. Switch to Network tab
  3. Enable "Disable cache" checkbox
  4. Refresh a Lovelace dashboard where an custom component is placed, or just do CTRL+SHIFT+R to refresh the page WITHOUT using already cached files
  5. Then all custom components are not recognized and won't work

20231123_firefox_custom_component

What version of Home Assistant Core has the issue?

core-2023.11.2

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

Firefox and Chrome 119.x

Which operating system are you using to run this browser?

Windows 11 and Ubuntu 21

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

No response

emandtf avatar Nov 23 '23 10:11 emandtf

I'll say I don't observe this. I have caching disabled and my custom cards load on reload.

Though I do use HTTP and not HTTPS, and I may have heard that the caching behavior is different between the two, something to do with https service workers. But I'm not that knowledgeable about that.

karwosts avatar Nov 23 '23 16:11 karwosts

I'm just "new" about Custom Components but I'm using HA from few years. Just yesterday I decided to implement two custom components and I've followed all guides to install them via HACS. Seems worked fine just installed because the installing procedure ended with an "refresh" action and the components were ready to be used.

Today I tested my HA from remote (port forwarded and reversed Nginx proxy for SSL) with issues I reported before.

Now I'm at home and I'm using Companion App while connected to Wifi and the App uses a local "HTTP://192.168..:8123" (directly to HA without anu proxy) connection, and this is the result most of the times I open the App in the same page reported before: SmartSelect_20231123_200619_Home Assistant Other times it loads correctly 🤷‍♂️

It's a bit frustrating.........

emandtf avatar Nov 23 '23 19:11 emandtf

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Feb 21 '24 21:02 github-actions[bot]

just something to remove stale

SuperSandro2000 avatar Feb 22 '24 20:02 SuperSandro2000

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 22 '24 21:05 github-actions[bot]