Skip to content

Commit

Permalink
Merge pull request #1661 from Caltech-IPAC/IRSA-6431-switch-tabs-expa…
Browse files Browse the repository at this point in the history
…nded-mode

IRSA-6431: Firefly tables in expanded mode was unable to switch tabs.
  • Loading branch information
loitly authored Oct 24, 2024
2 parents 57c1a73 + b01c426 commit d65addb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/firefly/html/test/tests-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ <h4>use tbl.relatedCols to highlight related rows</h4>
const table2 = { tbl_id: 'table2', tableData: { columns, data } };
const table3 = { tbl_id: 'table3', tableData: { columns, data } };
firefly.showClientTable('single', table1);
firefly.showClientTable('single', table2);
firefly.showClientTable('tabs', table2);
firefly.showClientTable('tabs', table3);
[2,3].forEach(i => {
const {tbl_ui_id} = firefly.util.table.getTableUiByTblId("table"+i);
Expand Down
10 changes: 2 additions & 8 deletions src/firefly/js/tables/ui/TablesContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,17 @@ const logger = Logger('Tables').tag('TablesContainer');

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

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

useEffect(() => {
if (expandedMode && mode !== 'standard') {
tbl_group = TblUtil.getTblExpandedInfo().tbl_group;
}
}, [expandedMode, mode]);

logger.debug('render... tbl_group: ' + tbl_group);

if (expandedMode) {
Expand Down

0 comments on commit d65addb

Please sign in to comment.