Skip to content

Commit 8c1c12b

Browse files
committed
fix: enable prefetching when navigating with arrow keys
1 parent ecdf280 commit 8c1c12b

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

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

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ export default class DataBrowser extends React.Component {
275275
if (this.props.errorAggregatedData != {}) {
276276
this.props.setErrorAggregatedData({});
277277
}
278-
this.props.callCloudFunction(
278+
this.handleCallCloudFunction(
279279
this.state.selectedObjectId,
280280
this.props.className,
281281
this.props.app.applicationId
@@ -478,19 +478,19 @@ export default class DataBrowser extends React.Component {
478478
// Up - standalone (move to the previous row)
479479
// or with ctrl/meta (excel style - move to the first row)
480480
let prevObjectID = this.state.selectedObjectId;
481+
const newRow = e.ctrlKey || e.metaKey ? 0 : Math.max(this.state.current.row - 1, 0);
481482
this.setState({
482483
current: {
483-
row: e.ctrlKey || e.metaKey ? 0 : Math.max(this.state.current.row - 1, 0),
484+
row: newRow,
484485
col: this.state.current.col,
485486
},
486487
});
487-
this.setState({
488-
selectedObjectId: this.props.data[this.state.current.row].id,
489-
showAggregatedData: true,
490-
});
491-
if (prevObjectID !== this.state.selectedObjectId && this.state.isPanelVisible) {
492-
this.props.callCloudFunction(
493-
this.state.selectedObjectId,
488+
const newObjectId = this.props.data[newRow].id;
489+
this.setSelectedObjectId(newObjectId);
490+
this.setState({ showAggregatedData: true });
491+
if (prevObjectID !== newObjectId && this.state.isPanelVisible) {
492+
this.handleCallCloudFunction(
493+
newObjectId,
494494
this.props.className,
495495
this.props.app.applicationId
496496
);
@@ -519,23 +519,23 @@ export default class DataBrowser extends React.Component {
519519
// Down - standalone (move to the next row)
520520
// or with ctrl/meta (excel style - move to the last row)
521521
prevObjectID = this.state.selectedObjectId;
522+
const newRow =
523+
e.ctrlKey || e.metaKey
524+
? this.props.data.length - 1
525+
: Math.min(this.state.current.row + 1, this.props.data.length - 1);
522526
this.setState({
523527
current: {
524-
row:
525-
e.ctrlKey || e.metaKey
526-
? this.props.data.length - 1
527-
: Math.min(this.state.current.row + 1, this.props.data.length - 1),
528+
row: newRow,
528529
col: this.state.current.col,
529530
},
530531
});
531532

532-
this.setState({
533-
selectedObjectId: this.props.data[this.state.current.row].id,
534-
showAggregatedData: true,
535-
});
536-
if (prevObjectID !== this.state.selectedObjectId && this.state.isPanelVisible) {
537-
this.props.callCloudFunction(
538-
this.state.selectedObjectId,
533+
const newObjectIdDown = this.props.data[newRow].id;
534+
this.setSelectedObjectId(newObjectIdDown);
535+
this.setState({ showAggregatedData: true });
536+
if (prevObjectID !== newObjectIdDown && this.state.isPanelVisible) {
537+
this.handleCallCloudFunction(
538+
newObjectIdDown,
539539
this.props.className,
540540
this.props.app.applicationId
541541
);

0 commit comments

Comments
 (0)