Skip to content

Commit d65addb

Browse files
authored
Merge pull request #1661 from Caltech-IPAC/IRSA-6431-switch-tabs-expanded-mode
IRSA-6431: Firefly tables in expanded mode was unable to switch tabs.
2 parents 57c1a73 + b01c426 commit d65addb

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

src/firefly/html/test/tests-table.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ <h4>use tbl.relatedCols to highlight related rows</h4>
507507
const table2 = { tbl_id: 'table2', tableData: { columns, data } };
508508
const table3 = { tbl_id: 'table3', tableData: { columns, data } };
509509
firefly.showClientTable('single', table1);
510-
firefly.showClientTable('single', table2);
510+
firefly.showClientTable('tabs', table2);
511511
firefly.showClientTable('tabs', table3);
512512
[2,3].forEach(i => {
513513
const {tbl_ui_id} = firefly.util.table.getTableUiByTblId("table"+i);

src/firefly/js/tables/ui/TablesContainer.jsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,17 @@ const logger = Logger('Tables').tag('TablesContainer');
2424

2525
export function TablesContainer(props) {
2626
const {mode='both', closeable=true, tableOptions, style, expandedMode:xMode=false} = props;
27-
let {tbl_group} = props;
27+
const expandedMode = useStoreConnector(() => xMode || getExpandedMode() === LO_VIEW.tables);
28+
const tbl_group = expandedMode && mode !== 'standard' ? TblUtil.getTblExpandedInfo().tbl_group : props.tbl_group;
2829

2930
const tables = useStoreConnector(() => TblUtil.getTableGroup(tbl_group)?.tables);
3031
const active = useStoreConnector(() => TblUtil.getTableGroup(tbl_group)?.active);
31-
const expandedMode = useStoreConnector(() => xMode || getExpandedMode() === LO_VIEW.tables);
3232
useStoreConnector((lastTitles) => {// force a rerender if any title ui changes
3333
const titles= getTblIdsByGroup().map( (tbl_id) => getTableUiByTblId(tbl_id)?.title);
3434
if (!lastTitles) return titles;
3535
return (union(titles,lastTitles).length === titles?.length) ? lastTitles : titles;
3636
});
3737

38-
useEffect(() => {
39-
if (expandedMode && mode !== 'standard') {
40-
tbl_group = TblUtil.getTblExpandedInfo().tbl_group;
41-
}
42-
}, [expandedMode, mode]);
43-
4438
logger.debug('render... tbl_group: ' + tbl_group);
4539

4640
if (expandedMode) {

0 commit comments

Comments
 (0)