-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
card-mod code may be not saved in UI editor - or just auto-deleted after typing - or may not be shown in editor #337
Comments
I am having the same problem. When the code is not shown again when reopening the editor, if I save it strips the previously saved card-mod changes. However, I am a novice with Card Mod. I do not use the "|" after styles. My previously-working code did not require it:
If I use that on a card, it works as expected. When I edit the card it disappears. When I save it reverts to unmodded. edit: It appears that cards with edited card-mod code is stripped from the editor upon reload. Card-mod code saved prior to the latest version, and left unedited, does NOT appear to be stripped upon reload. |
Same issue after updating to 3.4.1 in Firefox. Using UI Editor the card_mod: config disappears after saving the card. It then doesn't render the changes. However, looking in the Raw Config the card_mod: config is present. |
@OmegaPrime90 |
I am now forced to edit the cards in the raw configuration editor. Quite the pain to find the code in a large dashboard. |
A probably related behaviour - but quite opposite:
|
Same Problem here |
Any news on this? I had the same problem, tried many things and suddenly the problem went away (I don't know what fixed it) but unfortunately only temporarily - since today the problem is back :-( |
I removed
from |
I've removed I found this thread https://community.home-assistant.io/t/install-card-mod-js-as-a-module-how/396758/9 which I think is saying that if you use lovelace in storage mode (i.e. using dashboard UI rather than in yaml), then this extra bit of yaml is not needed in the config file. |
Sorry the link isn't correct, I'm new to posting here. https://community.home-assistant.io/t/install-card-mod-js-as-a-module-how/396758 |
Where exactly it was said? |
Post number 9 "You are using storage mode now. You don’t have to worry about this. You don’t need to add anything to your configuration.yaml file. Check the Configuration / Dashboard / Resources tab and make sure card_mod is listed there as a javascript module and you are good to go." |
And you may add post 10 telling the opposite. Better to ask the author. May be that person was right, but this needs a proof. |
Absolutely we need the author's opinion. So far in my own testing with the frontend resource removed the code is now saving correctly so maybe this is relevant or perhaps it's a coincidence. |
Also, that line was added with a purpose. |
I am not at all able to reproduce this issue. It may be a clue that this problem doesn't appear without it, but I still don't know. |
I did not manage to reproduce on a fresh test HA installation. Installed bar-card, tested the code provided above - no glitch. Updated to 3.4.2 on the main setup. |
I can confirm that deleting this line, a HA restart and with a hard reload/cleared cache of the browser it is working fine. When I put the line back, and doing a reload/restart, the bug is back. |
Case similar to #337 (comment): card_mod code not shown in Editor: but it present in fact: |
Yesterday I found out that I'm having this problem too. Update: I did as others above said removing the entry from |
Same issue here. |
Same here. Card-mod code is deleted from the first tile card in a vertical stack when opening the card in visual edit mode and then saving. Card-mod version 3.4.2 and core-2024.2.2. Started after updating to 2024.2.2, but also chrome was updated about the same time to version 121.0.6167.185. Removing "frontend: extra_module_url: - /hacsfiles/lovelace-card-mod/card-mod.js" from configuration.yaml and restarting HA did not fix the issue. |
For me removing the extra module is solving the problem.
But only when lovelace is set to yaml. In storage mode there is no improvement.
@thomasloven did you tried this to reproduce the problem? @greg520820 and @EF01 can you confirm that you have lovelace set to storage and the fix is working if you change lovelace to yaml? |
Always have been in storage mode. After removing "- /hacsfiles/lovelace-card-mod/card-mod.js" from configuration.yaml and restarting HA and host machine many times, trying to fix another issue, the card-mod code quit disappearing. Also had cleared the stored files and images in Chrome. Added the "- /hacsfiles/lovelace-card-mod/card-mod.js" back and have not had any problems. |
Sorry, how this can help to fix the glitch in yaml mode - if the glitch is observed only in UI editor, i.e. in storage mode? |
This problem appeared in the UI editor, wether lovelace is in yaml or storage mode. Maybe I misunderstood something. Neverteless I played around with my dashboard and at the moment it seems to be dissapeared as @greg520820 also experienced. |
When you are using UI editor (which may be switch between showing UI controls to define card's option & showing yaml editor for THIS card) - you are definitely using this dashboard in a "storage mode". A dashboard in a "yaml mode" is a completely different thing: to edit a dashboard you need to edit it;s yaml-files in some EXTERNAL text editor (in case of using HassOS - could be a pre-installed addon). |
Yes, the issue is solved by this when editing in yaml. But still occours when editing in ui. |
Any News how to fix this? |
Try clearing out your browser cache. Delete any store files or images in your browser. May also need to delete browsing history. On chrome just clearing files/images under settings fixed the issue. |
@greg520820 nope not in my case :(, but thanks |
Still seeing this issue, tried all the above and still no luck. |
I discovered, that content is not saved when you paste something containing TAB character. HA stores it as \t, cannot parse it and decides to ditch the changes all together. I've changed it to spaces and it works every time. BTW if you type TAB in Home Assistant Web UI Code Editor, it gets converted to spaces, but when pasted directly (from notepad++) it will contain real TAB character and will brake the parser. |
@SergiPL
P.S. I guess you were talking about saving "\t" inside a |
@ildar170975 - sorry it didn't solve your issue, but still - someone can have those TABs and as they are quite difficult to track, I decided to share this information. In your example however I see 3 strange things: First - there is something wrong even before leaving the editor as the change of the colour to red should be visible immediately on a preview on the right. It should be instant (if you type "red", the very moment when you type "d" it should change the color) - like here: Second (maybe irrelevant) - the bar-card component says it stopped being maintained 4 years ago... Perhaps you can try styling some standard out of the box HA component to check if the issue applies? Third - in the post above there are unnecessary quotes: style: "ha-card{color: red}" This is working for me 100%:
PS: yes that's what I ment. |
And maybe you can also try to style component that is directly on the dashboard level (not inside vertical-stack) and see how that goes. For vertical-stack this works for me:
|
The example you gave with sun.sun component also doesn't work on my side. That's because internal span with text overwrites this with default colour (taken from --primary-text-color). But this one works on my side:
Anyway - I can't replicate your issue on my local HA and I am out of further ideas. On my side - it just works correctly (once I enter the correct component definition). |
i also checked my configs and my tabs was autoamtically converted to spaces, dont know why or when. but the card_mods will be removed now in my cases only when card_mod is not fully loaded, when it is fully loaded it works, I don't know since when, so my case is closed :) |
You seem to not get a purpose of using simplest |
I get it, but I also think it is good to use something that actually shows on the screen. Anyway - good luck with solving your issue. |
Having the same issue on the latest HA/Card-mod versions. Just wondering, has anyone here specified the perfomance code (below) in their config? I'm wondering if this maybe related... frontend:
It's either that, on it occurs when you add Keyframes animations code to card-mod. |
Chrome 120.0.6099.130 (Win10x64).
FF 121 (Win10x64).
My Home Assistant version: 2023.12.1
My lovelace configuration method (GUI or yaml): storage
What I am doing:
Adding card-mod code for
custom:bar-card
inside a standardvertical-stack
.Using a standard HA UI editor.
What I expected to happen:
Card-mod code is saved after saving a card.
What happened instead:
Minimal steps to reproduce:
Error messages from the browser console:
none related.
By putting an X in the boxes ([]) below, I indicate that I:
Understand that this is a channel for reporting bugs, not a support forum (https://community.home-assistant.io/).
Have made sure I am using the latest version of the plugin.
Have followed the troubleshooting steps of the "Common Problems" section of https://github.com/thomasloven/hass-config/wiki/Lovelace-Plugins.
Understand that leaving one or more boxes unticked or failure to follow the template above may increase the time required to handle my bug-report, or cause it to be closed without further action.
The text was updated successfully, but these errors were encountered: