-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fix 'Move to view' operation #21142
Fix 'Move to view' operation #21142
Conversation
WalkthroughWalkthroughThe update in Changes
Assessment against linked issues
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Additional context usedBiome
Additional comments not posted (1)
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: 0
Outside diff range comments (1)
src/panels/lovelace/components/hui-card-options.ts (1)
Line range hint
88-88
: Replace non-null assertions with optional chaining.Multiple lines in the file use the TypeScript non-null assertion operator (
!
). This operator can lead to runtime errors if the object is null or undefined. It's safer to replace these with the optional chaining operator (?.
), which includes runtime checks.- this.lovelace!.config + this.lovelace?.config - this.hass!.localize + this.hass?.localize - this._cards!.length + this._cards?.lengthAlso applies to: 93-93, 94-94, 98-98, 105-105, 114-114, 124-124, 131-131, 137-137, 144-144, 154-154, 163-163, 172-172, 181-181, 190-190, 283-283, 284-284, 285-285, 287-287
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.
Thank you @karwosts!
Proposed change
When moving a card to a new dashboard, code was incorrectly taking the index of the view to move to, and incorrectly using this index to lookup a view in the dashboard being moved from, and getting an undefined view and throwing an exception.
This also means the move to section view check was not working correctly in this case.
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed:
Summary by CodeRabbit