Skip to content

Fix compatibility with Home Assistant 20260304.0 - #119

Open
fmierlo wants to merge 1 commit into
TJPoorman:mainfrom
fmierlo:fix/ha-20260304-compatibility
Open

Fix compatibility with Home Assistant 20260304.0#119
fmierlo wants to merge 1 commit into
TJPoorman:mainfrom
fmierlo:fix/ha-20260304-compatibility

Conversation

@fmierlo

@fmierlo fmierlo commented Mar 10, 2026

Copy link
Copy Markdown

Summary

Home Assistant 20260304.0 removed several UI components and APIs that this integration relied on, causing the actions menu to break and buttons to disappear. This PR updates the panel to use the current HA component API.

Resolves: #118

Changes

Broken component replacements

  • ha-md-menuha-dropdown and ha-md-menu-itemha-dropdown-item: the ha-md-menu component was removed in 20260304.0. The actions menu now uses ha-dropdown with @wa-select for item handling and .open = true instead of the removed .show() method.
  • mwc-buttonha-button: replaced all uses of the deprecated Material Web Component button.

Dropdown anchor stability

Added _openingMenu flag with @wa-after-show / @wa-after-hide event handlers on the dropdown to properly clear anchorElement when the menu closes. Without this, the dropdown drifted to the top-left corner after any page re-render because the anchor button (inside ha-data-table rows) was recreated by lit-virtualizer.

Prevent unnecessary re-renders

  • _columnsToDisplay is now cached by narrow value, returning a stable object reference to ha-data-table unless the layout actually changes.
  • _rows getter → _tableRows @state(): table rows are now computed once per loadData() call instead of on every render. This prevents ha-data-table from seeing a changed data reference on every parent render, which was causing lit-virtualizer to fire constant rangeChanged events and recreate all row elements.

Data loading improvements

  • Extracted connect() to load config, registry, and label registry once on component mount.
  • loadData() now fetches tags and tasks first and then sets all state synchronously, ensuring LitElement batches everything into a single render. This prevents ha-data-table from briefly rendering with empty data (which caused lit-virtualizer to initialize with an empty range and fail to display rows when the table was initially off-screen).

Testing

  • Actions menu (three-dot button per row) opens and stays anchored correctly
  • Edit and delete actions work from the menu
  • Add task button is visible and functional
  • Edit dialog save/cancel buttons are visible and functional
  • Table renders correctly when scrolled into view on initial load

Note: This is a proof of concept put together with AI assistance (Claude Code). I'm running Home Assistant 20260304.0 and hit these issues myself, so I wanted to share what worked for me. I don't have enough knowledge of the codebase to properly review or validate these changes, so I have no expectation that this will be merged as-is. Sharing in case it's useful as a reference or starting point for someone who can do it properly.

- Replace ha-md-menu/ha-md-menu-item with ha-dropdown/ha-dropdown-item
  and use .open=true instead of removed .show() method
- Replace mwc-button with ha-button
- Add _openingMenu flag and wa-after-hide handler to prevent dropdown
  drifting to top-left after page re-renders
- Cache _columnsToDisplay by narrow to prevent unnecessary ha-data-table
  re-renders and lit-virtualizer range changes
- Replace _rows getter with _tableRows @State updated only in loadData()
  so ha-data-table receives a stable data reference between reloads
- Extract connect() to load config/registry once; loadData() now fetches
  tags and tasks, setting all state synchronously to avoid intermediate
  empty renders that caused lit-virtualizer to miss visible items

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Edit + Delete Buttons stuck in bottom left of screen

1 participant