mirror of
https://github.com/home-assistant/frontend.git
synced 2026-11-16 18:03:03 +00:00
Fill free slots when pinned entities do not all fit
When the pinned entities use more slots than the limit, the ones that fit can still leave a free slot. For example, two pinned cameras with a limit of 3. The section now checks the size of the pinned entities that fit, and fills the free slot with a suggestion. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EzDS5HYRVdFHKnLsjPaoyy
This commit is contained in:
1 file changed
+3
-2
@@ -87,9 +87,10 @@ export class CommonControlsSectionStrategy extends ReactiveElement {
|
||||
);
|
||||
|
||||
// Pinned entities already fill the section, skip the prediction call.
|
||||
if (computeFavoriteCardsSize(includedEntities) >= limit) {
|
||||
const fittedIncludedEntities = fitToLimit(includedEntities, limit);
|
||||
if (computeFavoriteCardsSize(fittedIncludedEntities) >= limit) {
|
||||
section.cards!.push(
|
||||
...fitToLimit(includedEntities, limit).map(computeFavoriteCardConfig)
|
||||
...fittedIncludedEntities.map(computeFavoriteCardConfig)
|
||||
);
|
||||
return section;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user