Skip to content

Commit d4bce76

Browse files
committed
fix: AggregationPanel scroll position persists when using cache
1 parent 17ce146 commit d4bce76

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ export default class DataBrowser extends React.Component {
132132
this.setShowRowNumber = this.setShowRowNumber.bind(this);
133133
this.handleCellClick = this.handleCellClick.bind(this);
134134
this.saveOrderTimeout = null;
135+
this.aggregationPanelRef = React.createRef();
135136
}
136137

137138
componentWillReceiveProps(props) {
@@ -734,6 +735,9 @@ export default class DataBrowser extends React.Component {
734735
const { prefetchCache } = this.state;
735736
const { prefetchStale } = this.getPrefetchSettings();
736737
const cached = prefetchCache[objectId];
738+
if (this.aggregationPanelRef.current) {
739+
this.aggregationPanelRef.current.scrollTop = 0;
740+
}
737741
if (
738742
cached &&
739743
(!prefetchStale || (Date.now() - cached.timestamp) / 1000 < prefetchStale)
@@ -902,7 +906,10 @@ export default class DataBrowser extends React.Component {
902906
resizeHandles={['w']}
903907
className={styles.resizablePanel}
904908
>
905-
<div className={styles.aggregationPanelContainer}>
909+
<div
910+
className={styles.aggregationPanelContainer}
911+
ref={this.aggregationPanelRef}
912+
>
906913
<AggregationPanel
907914
data={this.props.AggregationPanelData}
908915
isLoadingCloudFunction={this.props.isLoadingCloudFunction}

0 commit comments

Comments
 (0)