Skip to content

Commit 4c382b3

Browse files
authored
fix: Info panel reloads despite prefetched data on cell click (#2918)
1 parent 0ebd007 commit 4c382b3

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ To reduce the time for info panel data to appear, data can be prefetched.
11851185
| `infoPanel[*].prefetchObjects` | Number | yes | `0` | `2` | Number of next rows to prefetch when browsing sequential rows. For example, `2` means the next 2 rows will be fetched in advance. |
11861186
| `infoPanel[*].prefetchStale` | Number | yes | `0` | `10` | Duration in seconds after which prefetched data is discarded as stale. |
11871187

1188-
Prefetching is particularly useful when navigating through lists of objects. To optimize performance and avoid unnecessary data loading, prefetching is triggered only after the user has moved through 3 consecutive rows using the keyboard down-arrow key.
1188+
Prefetching is particularly useful when navigating through lists of objects. To optimize performance and avoid unnecessary data loading, prefetching is triggered only after the user has moved through 3 consecutive rows using the keyboard down-arrow key or by mouse click.
11891189

11901190
### Freeze Columns
11911191

src/components/BrowserCell/BrowserCell.react.js

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,6 @@ export default class BrowserCell extends Component {
567567
current,
568568
onEditChange,
569569
setCopyableValue,
570-
selectedObjectId,
571-
setSelectedObjectId,
572-
callCloudFunction,
573-
isPanelVisible,
574570
onPointerCmdClick,
575571
row,
576572
col,
@@ -580,7 +576,6 @@ export default class BrowserCell extends Component {
580576
markRequiredFieldRow,
581577
handleCellClick,
582578
selectedCells,
583-
setShowAggregatedData,
584579
} = this.props;
585580

586581
const classes = [...this.state.classes];
@@ -653,18 +648,7 @@ export default class BrowserCell extends Component {
653648
onPointerCmdClick(value);
654649
} else {
655650
setCopyableValue(hidden ? undefined : this.copyableValue);
656-
if (selectedObjectId !== this.props.objectId) {
657-
setShowAggregatedData(true);
658-
setSelectedObjectId(this.props.objectId);
659-
if (
660-
this.props.objectId &&
661-
isPanelVisible &&
662-
((e.shiftKey && !this.props.firstSelectedCell) || !e.shiftKey)
663-
) {
664-
callCloudFunction(this.props.objectId, this.props.className, this.props.appId);
665-
}
666-
}
667-
handleCellClick(e, row, col);
651+
handleCellClick(e, row, col, this.props.objectId);
668652
}
669653
}}
670654
onDoubleClick={() => {

src/dashboard/Data/Browser/DataBrowser.react.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,10 +758,26 @@ export default class DataBrowser extends React.Component {
758758
});
759759
}
760760

761-
handleCellClick(event, row, col) {
761+
handleCellClick(event, row, col, objectId) {
762762
const { firstSelectedCell } = this.state;
763763
const clickedCellKey = `${row}-${col}`;
764764

765+
if (this.state.selectedObjectId !== objectId) {
766+
this.setShowAggregatedData(true);
767+
this.setSelectedObjectId(objectId);
768+
if (
769+
objectId &&
770+
this.state.isPanelVisible &&
771+
((event.shiftKey && !firstSelectedCell) || !event.shiftKey)
772+
) {
773+
this.handleCallCloudFunction(
774+
objectId,
775+
this.props.className,
776+
this.props.app.applicationId
777+
);
778+
}
779+
}
780+
765781
if (event.shiftKey && firstSelectedCell) {
766782
const [firstRow, firstCol] = firstSelectedCell.split('-').map(Number);
767783
const [lastRow, lastCol] = clickedCellKey.split('-').map(Number);

0 commit comments

Comments
 (0)