Add registryDependencies to strategies for selective regeneration#30102
Draft
Add registryDependencies to strategies for selective regeneration#30102
Conversation
13 tasks
773faba to
47996c8
Compare
- Remove `force` flag from `hui-root` that was clearing the entire view cache and destroying all cached view DOM on any config change. Views now receive updated lovelace in place and handle config changes internally. - Add `_cleanupViewCache` to remove stale cache entries when views are added, removed, or reordered. - Remove `@ll-rebuild` handler from `hui-root`. Cards and badges already handle `ll-rebuild` via their `hui-card`/`hui-badge` wrappers. Sections now always stop propagation and rebuild locally. - Add `deepEqual` guard in `hui-view._setConfig` and `hui-section._initializeConfig` to skip re-rendering when strategy regeneration produces an identical config. - Simplify `hui-view` refresh flow: remove `_refreshConfig`, `_rendered` flag, `strategy-config-changed` event, and connected/disconnected callbacks. Registry changes now debounce directly into `_initializeConfig`. - Fix `isStrategy` check in `hui-view._initializeConfig` to use the raw config (before strategy expansion) rather than the generated config. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…y interface Strategies can now declare which registries they depend on via a static `registryDependencies` property. A `shouldRegenerate` method can also be implemented for custom logic. The `checkStrategyShouldRegenerate` helper uses these to decide whether regeneration is needed, falling back to checking entities, devices, areas, and floors by default. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace hardcoded registry checks with checkStrategyShouldRegenerate in hui-view, hui-section, ha-panel-lovelace, and ha-panel-home. Regeneration checks are also extended to sections (previously only dashboards and views were checked). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
47996c8 to
ea5c481
Compare
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.
Proposed change
Strategies currently regenerate whenever any registry changes (entities, devices, areas, floors), even for strategies like iframe or map that don't depend on any registry data.
Each strategy can now declare which registries it depends on via a static
registryDependenciesproperty. Regeneration only happens when relevant data changes. Strategies with no dependencies never regenerate; strategies like the home dashboard only regenerate when areas change.Regeneration checks are also extended to views and sections, not just dashboards.
Type of change
Additional information
Checklist
To help with the load of incoming pull requests: