fix(panel): stop blank panel on HA 2026.8 (history preload crash) - #14
Merged
Conversation
… 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>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Symptom
On HA 2026.8, the Data Points panel renders blank. Console shows:
Cause
preloadHistoryRouteComponents(insrc/lib/ha/ha-components.ts) force-loads the history route's components by creating apartial-panel-resolver, assigning it a{ panels }stub hass, and calling_updateRoutes():_updateRoutesreads more hass fields and dereferences.externaloff one the stub doesn't have →TypeError._updateRoutesis now async, and it was called withoutawait, so the rejection escaped the surroundingtry/catchas an unhandled promise rejection. That derailed the panel'sconnectedCallbackpreload chain (_ensureUiComponentsReadyonly builds the shell on the success path), so the shell never built → blank panel.Fix
home-assistanthass 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 readpanels, and it gives 2026.8 the field it dereferences.await_updateRoutes()so any failure is caught by the existing best-efforttry/catchand the preload degrades gracefully (logs a warning, panel still renders) instead of blanking.Both changes are strictly safer across HA versions:
await undefinedis a no-op on older synchronous_updateRoutes.Verification
pnpm lint(eslint + package-json + prettier + tsc) ✅pnpm exec vitest run …/ha-components.spec.ts✅pnpm buildrebuilt and committed (bundle banner → v0.6.2)Note: I attempted a unit regression test but the shared
ha-stubs.tspre-registers the history pickers globally, which structurally prevents the preload path from running under vitest without brittlecustomElementsmocking — left out rather than ship a flaky/timeout-prone test.Bumps to 0.6.2.
🤖 Generated with Claude Code