Skip to content

fix(panel): stop blank panel on HA 2026.8 (history preload crash) - #14

Merged
buggedcom merged 1 commit into
mainfrom
fix/panel-blank-history-preload
Aug 24, 2026
Merged

fix(panel): stop blank panel on HA 2026.8 (history preload crash)#14
buggedcom merged 1 commit into
mainfrom
fix/panel-blank-history-preload

Conversation

@buggedcom

Copy link
Copy Markdown
Owner

Symptom

On HA 2026.8, the Data Points panel renders blank. Console shows:

partial-panel-resolver.ts:231 Uncaught (in promise) TypeError:
  Cannot read properties of undefined (reading 'external')
  ← preloadHistoryRouteComponents (bundle)
  ← ensureHaComponents → _ensureUiComponentsReady → connectedCallback

Cause

preloadHistoryRouteComponents (in src/lib/ha/ha-components.ts) force-loads the history route's components by creating a partial-panel-resolver, assigning it a { panels } stub hass, and calling _updateRoutes():

  1. On HA 2026.8 _updateRoutes reads more hass fields and dereferences .external off one the stub doesn't have → TypeError.
  2. _updateRoutes is now async, and it was called without await, so the rejection escaped the surrounding try/catch as an unhandled promise rejection. That derailed the panel's connectedCallback preload chain (_ensureUiComponentsReady only builds the shell on the success path), so the shell never built → blank panel.

Fix

  • Pass the real home-assistant hass to the resolver instead of the { panels } stub. It's a superset of the old stub (still has .panels), so it's backward-compatible with older cores that only read panels, and it gives 2026.8 the field it dereferences.
  • await _updateRoutes() so any failure is caught by the existing best-effort try/catch and the preload degrades gracefully (logs a warning, panel still renders) instead of blanking.

Both changes are strictly safer across HA versions: await undefined is a no-op on older synchronous _updateRoutes.

Verification

  • pnpm lint (eslint + package-json + prettier + tsc) ✅
  • pnpm exec vitest run …/ha-components.spec.ts
  • pnpm build rebuilt and committed (bundle banner → v0.6.2)

Note: I attempted a unit regression test but the shared ha-stubs.ts pre-registers the history pickers globally, which structurally prevents the preload path from running under vitest without brittle customElements mocking — left out rather than ship a flaky/timeout-prone test.

Bumps to 0.6.2.

🤖 Generated with Claude Code

… hass

preloadHistoryRouteComponents created a partial-panel-resolver, assigned it
a { panels } stub hass, and called _updateRoutes() without awaiting. On HA
2026.8 _updateRoutes is async and reads additional hass fields (dereferencing
.external off one the stub lacks), so it threw "Cannot read properties of
undefined (reading 'external')". Because the call wasn't awaited, the rejection
escaped the surrounding try/catch as an unhandled promise rejection and
derailed the panel's connectedCallback preload chain, so the shell never built
and the panel rendered blank.

Pass the real home-assistant hass (a superset of the old stub, so still
backward-compatible with older cores where only panels was read) and await
_updateRoutes so any failure is caught and the preload degrades gracefully
instead of blanking the panel.

Rebuilds the bundle and bumps to 0.6.2.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@buggedcom
buggedcom merged commit 2e1a0e9 into main Aug 24, 2026
15 checks passed
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.

1 participant