From 976868a29bc21b8be553556b41232c0d59923c61 Mon Sep 17 00:00:00 2001 From: Shante Austin Date: Fri, 6 Sep 2024 09:09:02 -0400 Subject: [PATCH 1/3] fix for content Items not showing if contnent is added after contentRows --- .../src/components/ControlRow/ControlRow.js | 6 +++- .../ControlRow/ControlRow.stories.js | 36 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/packages/@lightningjs/ui-components/src/components/ControlRow/ControlRow.js b/packages/@lightningjs/ui-components/src/components/ControlRow/ControlRow.js index 40b5e9237..e81be5b08 100644 --- a/packages/@lightningjs/ui-components/src/components/ControlRow/ControlRow.js +++ b/packages/@lightningjs/ui-components/src/components/ControlRow/ControlRow.js @@ -122,7 +122,7 @@ export default class ControlRow extends TitleRow { _appendItemsAt(items, appendIndex, removeSpacingIndex) { const itemsCopy = [...items]; - if (removeSpacingIndex != undefined) { + if (removeSpacingIndex != undefined && removeSpacingIndex >= 0) { this.items[removeSpacingIndex].extraItemSpacing = undefined; itemsCopy[itemsCopy.length - 1].extraItemSpacing = this.extraItemSpacing == undefined @@ -133,6 +133,7 @@ export default class ControlRow extends TitleRow { } addContentItems(items) { + const lastSelected = this.selectedIndex; const itemsToAdd = this._createContentItems(items); const addIndex = this._lastItemIndex + 1; this._appendItemsAt(itemsToAdd, addIndex, this._lastItemIndex); @@ -142,6 +143,9 @@ export default class ControlRow extends TitleRow { this._contentItems = [...this.contentItems, ...itemsToAdd]; } + this._updateContent(); + this.selectedIndex = lastSelected; + this.patch({ stopLazyScrollIndex: this.leftControls.length + this.items.length - 1 }); diff --git a/packages/@lightningjs/ui-components/src/components/ControlRow/ControlRow.stories.js b/packages/@lightningjs/ui-components/src/components/ControlRow/ControlRow.stories.js index ec4b5c8a3..098846cb2 100644 --- a/packages/@lightningjs/ui-components/src/components/ControlRow/ControlRow.stories.js +++ b/packages/@lightningjs/ui-components/src/components/ControlRow/ControlRow.stories.js @@ -83,6 +83,42 @@ export const Basic = () => } }; +export const Bug = () => + class Bug extends lng.Component { + static _template() { + return { + ControlRow: { + type: ControlRowComponent, + leftControls: [], + contentItems: [], + rightControls: [], + lazyLoadBuffer: 1 + } + }; + } + + _construct() { + setTimeout(() => { + if (this._ControlRow) { + this._ControlRow.addContentItems( + createItems( + 3, + 'https://image.tmdb.org/t/p/w500/frwl2zBNAl5ZbFDJGoJv0mYo0rF.jpg' + ) + ); + } + }, 1500); + } + _getFocused() { + return this.tag('ControlRow'); + } + + get _ControlRow() { + return this.tag('ControlRow'); + } + }; + + export const LazyLoading = () => class LazyLoading extends lng.Component { static _template() { From 8f8e1f93a70987c8a2c231a97aa4f5d172004f96 Mon Sep 17 00:00:00 2001 From: Shante Austin Date: Fri, 6 Sep 2024 09:14:57 -0400 Subject: [PATCH 2/3] lint fix error --- .../src/components/ControlRow/ControlRow.stories.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/@lightningjs/ui-components/src/components/ControlRow/ControlRow.stories.js b/packages/@lightningjs/ui-components/src/components/ControlRow/ControlRow.stories.js index 098846cb2..c57265a57 100644 --- a/packages/@lightningjs/ui-components/src/components/ControlRow/ControlRow.stories.js +++ b/packages/@lightningjs/ui-components/src/components/ControlRow/ControlRow.stories.js @@ -118,7 +118,6 @@ export const Bug = () => } }; - export const LazyLoading = () => class LazyLoading extends lng.Component { static _template() { From f4bdef5314768518a7868951153139e2699589af Mon Sep 17 00:00:00 2001 From: Shante Austin Date: Tue, 10 Sep 2024 16:36:57 -0400 Subject: [PATCH 3/3] removed bug test function" --- .../ControlRow/ControlRow.stories.js | 35 ------------------- 1 file changed, 35 deletions(-) diff --git a/packages/@lightningjs/ui-components/src/components/ControlRow/ControlRow.stories.js b/packages/@lightningjs/ui-components/src/components/ControlRow/ControlRow.stories.js index c57265a57..ec4b5c8a3 100644 --- a/packages/@lightningjs/ui-components/src/components/ControlRow/ControlRow.stories.js +++ b/packages/@lightningjs/ui-components/src/components/ControlRow/ControlRow.stories.js @@ -83,41 +83,6 @@ export const Basic = () => } }; -export const Bug = () => - class Bug extends lng.Component { - static _template() { - return { - ControlRow: { - type: ControlRowComponent, - leftControls: [], - contentItems: [], - rightControls: [], - lazyLoadBuffer: 1 - } - }; - } - - _construct() { - setTimeout(() => { - if (this._ControlRow) { - this._ControlRow.addContentItems( - createItems( - 3, - 'https://image.tmdb.org/t/p/w500/frwl2zBNAl5ZbFDJGoJv0mYo0rF.jpg' - ) - ); - } - }, 1500); - } - _getFocused() { - return this.tag('ControlRow'); - } - - get _ControlRow() { - return this.tag('ControlRow'); - } - }; - export const LazyLoading = () => class LazyLoading extends lng.Component { static _template() {