github ReikanYsora/Helios v1.8.2-alpha.11
v1.8.2-alpha.11: eager pool + handshake (#162)

latest releases: v1.8.2-beta.0, v1.8.2-alpha.12
pre-release5 hours ago

Engine pool with eager registration + (home, mode) key + owner handshake

Definitive fix for the per-commit WebGL respawn (#162). Investigated by reading the Home Assistant frontend source directly (hui-card.ts on the dev branch).

Why the previous attempts failed

hui-card._loadElement (lines 121-166) executes the rebuild in this order:

  1. tryCreateCardElement(newConfig) constructs the NEW helios-card and calls setConfig on it.
  2. this.removeChild(oldElement) removes the old child, firing the OLD card's disconnectedCallback.
  3. this.appendChild(newElement) attaches the new child, firing its connectedCallback.

The previous attempts pushed the engine into the pool from step 2. By that point the NEW card had already been constructed in step 1 and was about to run its updated() lifecycle, which would allocate a fresh WebGL context before the pool was even populated.

Fix

  • Eager registration. Every engine pushes itself into the pool the moment it is created in initEngineNow, not at disconnectedCallback. When the slider commit triggers the rebuild, the NEW card's updated() finds the OLD card's engine waiting in the pool.
  • (home, mode) key. HA sets element.preview = true on the editor preview pane (hui-card.ts:136-138). The pool key now includes that flag so a preview card never claims the live dashboard tile's engine, and the live dashboard never claims a preview's engine.
  • Owner handshake. Each pool entry tracks lastOwner. Claiming reassigns the owner and cancels any pending dispose. Releasing is a no-op when the releaser is no longer the registered owner (the OLD card calling release AFTER the NEW card has already claimed). When the releaser IS still the owner (real navigation away), release schedules a dispose after the grace window.

Internals

  • pushEngineToPool / tryClaimPooledEngine removed.
  • registerEngineInPool / claimEngineFromPool / releaseEngineFromPool / isCurrentPoolOwner added.
  • Pool grace widened from 1.5 s to 2.5 s to absorb the 1 s mount-debounce a fresh card incurs before its first initEngine.

Validation

window.heliosStats(), before and after a slider drag in the editor, should now show enginesCreated unchanged. The basemap should render normally in the editor preview pane. The dashboard tile should be untouched.

Installation

Pick v1.8.2-alpha.11 in HACS (show beta versions toggle), or download helios.js from this release and drop it under config/www/community/helios/ replacing the existing bundle. Refresh the dashboard.

Don't miss a new Helios release

NewReleases is sending notifications on new releases.