UI-Lovelace-Minimalist / UI

UI-Lovelace-Minimalist is a "theme" for HomeAssistant
https://ui-lovelace-minimalist.github.io/UI/
Other
1.57k stars 421 forks source link

Custom card changes not being applied unless a full HA restart is performed #1386

Open hheimbuerger opened 8 months ago

hheimbuerger commented 8 months ago

Describe the bug In my specific configuration, when modifying a custom card, I need to do a full reload of HA to get changes of custom cards to be rendered onto the dashboard.

To Reproduce Steps to reproduce the behavior:

  1. Install the HA Docker container. (Tested on 2023.10.1)
  2. Set up /config inside the container as a bind mount into the host operating system.
  3. Create a custom card (ui_lovelace_minimalist/custom_cards/custom_card_foobar_test/custom_card_foobar_test.yaml)
  4. Integrate this card into a dashboard. Restart HA for good measure. Confirm that the card renders correctly on the dashboard.
  5. Modify the card (e.g. change the label) by changing the YAML file on the host operating system.
  6. Reload the UI LOVELACE MINIMALIST YAML configuration in the Developer Tools.
  7. Press Ctrl-F5 in the browser.

Expected behavior The modified card to be displayed, the new label to show up.

Actual behavior The card is rendered exactly as before, using the old label. Notably, custom_components\ui_lovelace_minimalist\__ui_minimalist__\ulm_templates\custom_cards\custom_card_foobar_test\custom_card_foobar_test.yaml still contains the old label, too.

Additional context Clicking on "RESTART" on the "Check and restart" section of the Development Tools does fix the issue! Doing that, then waiting for a couple seconds, makes the new label appear. Needless to say, that's a rather pretty slow development experience. I also couldn't find any mention of this behavior in the wiki, so I believe it's not intended.

(I tried everything with my custom card for two hours, wondering why it wouldn't work. Then an unrelated reboot fixed it, and I was happy for a minute. Then I wondered for another hour why all my following changes didn't have an effect.)

From other projects, I'm aware of the frustration around bind mounts not reporting file changes properly. Although I've only experienced this issue in the other direction. (The host FS not picking up on changes made by the container.) So my suspicion is that this issue is related to that problem.

Can someone point me to documentation about this "custom card into __ui_minimalist__ copying" subsystem? What's its purpose? When exactly is it supposed to run? What is it doing exactly, and why? Does it exist only because !include_dir_merge_named cannot merge multiple folder trees?

386408003 commented 8 months ago

By the way, in UI Lovelace Minimalist faq, I fand this, but don't know where can I hit c? can it resolve this problem? in this url: https://ui-lovelace-minimalist.github.io/UI/troubleshooting/troubleshooting/

  1. Hit C and click reload Ui_lovelace_minimalist
  2. Clear your cache by clicking CTRL + F5 on Windows or SHIFT + reload on Mac
386408003 commented 8 months ago

I find a way to resolve it ! @hheimbuerger modify yaml and then click reload in the dashboard, it will works! image

hheimbuerger commented 8 months ago

I find a way to resolve it ! @hheimbuerger modify yaml and then click reload in the dashboard, it will works! image

That only works when changing the dashboard itself. But my issue is around modifying custom cards, as documented above.

Please open a new ticket! Your issue is unrelated to this one.

basbruss commented 8 months ago

Actually both are quite similar. After you have reloaded the integration you should also refresh the dashboard as is shown by @386408003

The frontend cache can be very persistent, CTRL + F5 only refreshes the browser cache which is not equal as the frontend cache.

386408003 commented 8 months ago

That only works when changing the dashboard itself. But my issue is around modifying custom cards, as documented above.

Please open a new ticket! Your issue is unrelated to this one.

sorry, I'm a freshman,I will delete my comment🤔

386408003 commented 8 months ago

Actually both are quite similar. After you have reloaded the integration you should also refresh the dashboard as is shown by @386408003

The frontend cache can be very persistent, CTRL + F5 only refreshes the browser cache which is not equal as the frontend cache.

Thank you, I got it. 😁

lterfloth commented 8 months ago

I do think I am experiencing the same issues. Whenever I change custom components, a full restart is required and reloading the configs / refreshing the dashboard is not enough. I do not know whether that is expected behaviour, but it makes development of custom cards rather tedious.

basbruss commented 8 months ago

@lterfloth in which directory are you working? The custom component has a dedicated dev-container and works the same as developing for each other integration, therefore, it needs to be restarted each time to load in the changes in the (custom) components folder because HA does only load integrations at its' startup.

On the other hand custom cards can be developed directly in your system without restarting your HA. Steps to follow are:

  1. develop in config/ui_lovelace_minimalist/custom_cards/
  2. reload the integration from the dev-tools or hit c on your keyboard and search for Reload UI Lovelace Minimalist
  3. Load in the adjusted templates into the frontend cache by clicking the three dots in the upper-right corner and selecting reload dashboard
  4. reload the page with (Shift)+CTRL+F5 to (hard) reset browser cache to be sure.
lterfloth commented 8 months ago

Will try these steps. Did not do "reload ui", that was a new one for me. Thanks!

hheimbuerger commented 8 months ago

On the other hand custom cards can be developed directly in your system without restarting your HA. Steps to follow are:

  1. develop in config/ui_lovelace_minimalist/custom_cards/
  2. reload the integration from the dev-tools or hit c on your keyboard and search for Reload UI Lovelace Minimalist
  3. Load in the adjusted templates into the frontend cache by clicking the three dots in the upper-right corner and selecting reload dashboard
  4. reload the page with (Shift)+CTRL+F5 to (hard) reset browser cache to be sure.

@basbruss That's what I've attempted, but I hope my original post made it clear that this is exactly what isn't working for me. Therefore my request for more documentation on details of the procedure ("how/when does Reload UI Lovelace Minimalist trigger the rebuild of the custom components?"), so that I have reference behavior I can troubleshoot my issue against.

My current workaround is to actually work inside custom_components\ui_lovelace_minimalist\__ui_minimalist__\ulm_templates\custom_cards\ instead, which is the directory these components are supposed to be built into (but aren't for me -- unless I do a full HA reboot!).
However, given that this isn't mentioned anywhere in the documentation, my assumption was that this isn't how you're supposed to work on custom components.

obfu5c8 commented 1 month ago

Resurrecting this old thread as I'm running into this issue today as well. Even making changes in the .../__ui_minimalist__/ulm_templates/... folder doesn't seem to have any effect - I can see my changes populated there, but even with a Reload UI Lovelace Minimalist run and a hard (cmd-shift-R) reload in chrome i don't see any changes until i do a full restart of HA