Custom card changes not being applied unless a full HA restart is performed
hheimbuerger opened this issue · 11 comments
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:
- Install the HA Docker container. (Tested on 2023.10.1)
- Set up
/config
inside the container as a bind mount into the host operating system. - Create a custom card (
ui_lovelace_minimalist/custom_cards/custom_card_foobar_test/custom_card_foobar_test.yaml
) - Integrate this card into a dashboard. Restart HA for good measure. Confirm that the card renders correctly on the dashboard.
- Modify the card (e.g. change the label) by changing the YAML file on the host operating system.
- Reload the
UI LOVELACE MINIMALIST
YAML configuration in the Developer Tools. - 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?
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/
- Hit C and click reload Ui_lovelace_minimalist
- Clear your cache by clicking CTRL + F5 on Windows or SHIFT + reload on Mac
I find a way to resolve it ! @hheimbuerger
modify yaml and then click reload in the dashboard, it will works!
I find a way to resolve it ! @hheimbuerger modify yaml and then click reload in the dashboard, it will works!
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.
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.
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🤔
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. 😁
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.
@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:
- develop in
config/ui_lovelace_minimalist/custom_cards/
- reload the integration from the dev-tools or hit
c
on your keyboard and search forReload UI Lovelace Minimalist
- Load in the adjusted templates into the frontend cache by clicking the three dots in the upper-right corner and selecting reload dashboard
- reload the page with (Shift)+CTRL+F5 to (hard) reset browser cache to be sure.
Will try these steps. Did not do "reload ui", that was a new one for me. Thanks!
On the other hand custom cards can be developed directly in your system without restarting your HA. Steps to follow are:
- develop in
config/ui_lovelace_minimalist/custom_cards/
- reload the integration from the dev-tools or hit
c
on your keyboard and search forReload UI Lovelace Minimalist
- Load in the adjusted templates into the frontend cache by clicking the three dots in the upper-right corner and selecting reload dashboard
- 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.