-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Remove empty electricity grid state #20794
Conversation
WalkthroughWalkthroughThe changes involve enhancing the Changes
Recent Review DetailsConfiguration used: CodeRabbit UI Files selected for processing (2)
Additional Context UsedBiome (29)
Additional comments not posted (2)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Outside diff range and nitpick comments (2)
src/panels/config/energy/components/ha-energy-grid-settings.ts (2)
Line range hint
378-378
: Avoid using non-null assertions.Non-null assertions are used in several places in this file. While they may be necessary due to the framework or specific coding patterns, it's generally safer to handle potential null or undefined values explicitly to prevent runtime errors.
Consider checking for null or undefined before usage or handling these cases gracefully.Also applies to: 410-410, 442-444, 469-471
Line range hint
10-10
: Optimize import statements.Some imports are only used as types. These can be imported using
import type
to clarify that they are only used for type checking and not included in the JavaScript output, optimizing the bundle size.- import { ConfigEntry, getConfigEntries } from "../../../../data/config_entries"; + import type { ConfigEntry } from "../../../../data/config_entries"; + import { getConfigEntries } from "../../../../data/config_entries";Apply this change to other similar imports throughout the file.
Also applies to: 15-19, 20-30, 31-34, 41-41
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Proposed change
When there's no longer a grid consumption or return to grid defined in the electricity grid section, the whole electricity grid section should be removed.
This is how it used to save after removing all grid sources:
This is how it will now save:
Given this situation, it now allows to say:
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed:
Summary by CodeRabbit