From 9a1f2cf8e36811bf68fc6e596c4ce74797a03ece Mon Sep 17 00:00:00 2001 From: Pim van Nierop Date: Mon, 17 Apr 2023 14:56:16 +0200 Subject: [PATCH] Use @observable.ref for hoveredStructVarTableRowIds PR feedback Aaron --- .../table/StructuralVariantMultiSelectionTable.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/pages/studyView/table/StructuralVariantMultiSelectionTable.tsx b/src/pages/studyView/table/StructuralVariantMultiSelectionTable.tsx index 59db8d86f2b..2b59643c596 100644 --- a/src/pages/studyView/table/StructuralVariantMultiSelectionTable.tsx +++ b/src/pages/studyView/table/StructuralVariantMultiSelectionTable.tsx @@ -108,7 +108,7 @@ export class StructuralVariantMultiSelectionTable extends React.Component< modalPanelName: '', }; - @observable private hoveredStructVarTableRowIds: string[] = []; + @observable.ref private hoveredStructVarTableRowIds: string[] = []; public static defaultProps = { cancerGeneFilterEnabled: false, @@ -635,9 +635,15 @@ export class StructuralVariantMultiSelectionTable extends React.Component< @action.bound onStructVarHover(rowId: string, isHovered: boolean) { if (isHovered) { - this.hoveredStructVarTableRowIds.push(rowId); + this.hoveredStructVarTableRowIds = [ + rowId, + ...this.hoveredStructVarTableRowIds, + ]; } else { - _.pull(this.hoveredStructVarTableRowIds, rowId); + this.hoveredStructVarTableRowIds = _.without( + this.hoveredStructVarTableRowIds, + rowId + ); } }