Freeze lovelace configuration on load#4862
Merged
Merged
Conversation
7774099 to
775f00d
Compare
Member
|
I would suggest this as way to copy: setConfig(config) {
config = {...config}; // create a mutable copy of the configuration
} |
Contributor
Author
|
That's a shallow copy, though. Isn't it? And ES...5? 6? (non IE) |
Member
|
Yes that is shallow, for deep just use the |
bramkragten
reviewed
Feb 13, 2020
balloob
reviewed
Feb 13, 2020
balloob
approved these changes
Feb 13, 2020
Member
balloob
left a comment
There was a problem hiding this comment.
Looks good. ok to merge when last comment addressed
bramkragten
reviewed
Feb 13, 2020
92 tasks
balloob
reviewed
Feb 13, 2020
balloob
approved these changes
Feb 13, 2020
Contributor
Author
|
A bit of an indication of how ready people are for this can be found in thomasloven/hass-config#6 |
Member
|
Thanks for going through HACS Thomas. It's not going to be released until 2 weeks from now, hopefully enough time. |
bramkragten
reviewed
Feb 14, 2020
| checkedConfig.views[index].badges = view.badges.filter(Boolean); | ||
| } | ||
| }); | ||
| return checkedConfig ? deepFreeze(checkedConfig) : config; |
Member
There was a problem hiding this comment.
This will now only freeze the config when there are faulty badges.
Contributor
Author
There was a problem hiding this comment.
You're right...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breaking change
#4851 but with freezing the entire configuration instead of cloning it for each card.
This will break some custom cards, but there's several simple fixes, e.g.:
or
depending on need and personal preference (besides rethinking the methodology of the card).
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: