Skip to content

Commit da57e5e

Browse files
authored
fix: Data browser table shows loading indicator when info panel is loading (#2782)
1 parent 1f08792 commit da57e5e

File tree

4 files changed

+20
-24
lines changed

4 files changed

+20
-24
lines changed

src/components/AggregationPanel/AggregationPanel.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const AggregationPanel = ({
3838
}
3939
}, [errorAggregatedData, setSelectedObjectId, setErrorAggregatedData]);
4040

41-
const isLoading = useMemo(
41+
const isLoadingInfoPanel = useMemo(
4242
() => depth === 0 && selectedObjectId && isLoadingCloudFunction && showAggregatedData,
4343
[depth, selectedObjectId, isLoadingCloudFunction, showAggregatedData]
4444
);
@@ -181,7 +181,7 @@ const AggregationPanel = ({
181181

182182
return (
183183
<div className={styles.aggregationPanel}>
184-
{isLoading ? (
184+
{isLoadingInfoPanel ? (
185185
<div className={styles.center}>
186186
<LoaderDots />
187187
</div>

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

+11-15
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class Browser extends DashboardView {
111111
configData: {},
112112
classwiseCloudFunctions: {},
113113
AggregationPanelData: {},
114-
isLoading: false,
114+
isLoadingInfoPanel: false,
115115
errorAggregatedData: {},
116116
};
117117

@@ -130,7 +130,7 @@ class Browser extends DashboardView {
130130
this.showExport = this.showExport.bind(this);
131131
this.login = this.login.bind(this);
132132
this.logout = this.logout.bind(this);
133-
this.setLoading = this.setLoading.bind(this);
133+
this.setLoadingInfoPanel = this.setLoadingInfoPanel.bind(this);
134134
this.setErrorAggregatedData = this.setErrorAggregatedData.bind(this);
135135
this.toggleMasterKeyUsage = this.toggleMasterKeyUsage.bind(this);
136136
this.showAttachRowsDialog = this.showAttachRowsDialog.bind(this);
@@ -255,9 +255,9 @@ class Browser extends DashboardView {
255255
}
256256
}
257257

258-
setLoading(bool) {
258+
setLoadingInfoPanel(bool) {
259259
this.setState({
260-
isLoading: bool,
260+
isLoadingInfoPanel: bool,
261261
});
262262
}
263263

@@ -269,7 +269,7 @@ class Browser extends DashboardView {
269269

270270
fetchAggregationPanelData(objectId, className, appId) {
271271
this.setState({
272-
isLoading: true,
272+
isLoadingInfoPanel: true,
273273
});
274274
const params = {
275275
object: Parse.Object.extend(className).createWithoutData(objectId).toPointer(),
@@ -283,18 +283,18 @@ class Browser extends DashboardView {
283283
Parse.Cloud.run(cloudCodeFunction, params, options).then(
284284
result => {
285285
if (result && result.panel && result.panel && result.panel.segments) {
286-
this.setState({ AggregationPanelData: result, isLoading: false });
286+
this.setState({ AggregationPanelData: result, isLoadingInfoPanel: false });
287287
} else {
288288
this.setState({
289-
isLoading: false,
289+
isLoadingInfoPanel: false,
290290
errorAggregatedData: 'Improper JSON format',
291291
});
292292
this.showNote(this.state.errorAggregatedData, true);
293293
}
294294
},
295295
error => {
296296
this.setState({
297-
isLoading: false,
297+
isLoadingInfoPanel: false,
298298
errorAggregatedData: error.message,
299299
});
300300
this.showNote(this.state.errorAggregatedData, true);
@@ -898,7 +898,6 @@ class Browser extends DashboardView {
898898

899899
async fetchParseData(source, filters) {
900900
const { useMasterKey, skip, limit } = this.state;
901-
this.setLoading(true);
902901
this.setState({
903902
data: null,
904903
})
@@ -931,8 +930,6 @@ class Browser extends DashboardView {
931930
this.setState({ isUnique, uniqueField });
932931

933932
const data = await promise;
934-
935-
this.setLoading(false);
936933
return data;
937934
}
938935

@@ -1121,7 +1118,7 @@ class Browser extends DashboardView {
11211118
ordering: ordering,
11221119
selection: {},
11231120
errorAggregatedData: {},
1124-
isLoading: false,
1121+
isLoadingInfoPanel: false,
11251122
AggregationPanelData: {},
11261123
},
11271124
() => this.fetchData(source, this.state.filters)
@@ -2098,9 +2095,8 @@ class Browser extends DashboardView {
20982095
classes={this.classes}
20992096
classwiseCloudFunctions={this.state.classwiseCloudFunctions}
21002097
callCloudFunction={this.fetchAggregationPanelData}
2101-
isLoadingCloudFunction={this.state.isLoading}
2102-
isLoading={this.state.isLoading}
2103-
setLoading={this.setLoading}
2098+
isLoadingCloudFunction={this.state.isLoadingInfoPanel}
2099+
setLoadingInfoPanel={this.setLoadingInfoPanel}
21042100
AggregationPanelData={this.state.AggregationPanelData}
21052101
setAggregationPanelData={this.setAggregationPanelData}
21062102
setErrorAggregatedData={this.setErrorAggregatedData}

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
* the root directory of this source tree.
77
*/
88
import BrowserRow from 'components/BrowserRow/BrowserRow.react';
9+
import Button from 'components/Button/Button.react';
910
import DataBrowserHeaderBar from 'components/DataBrowserHeaderBar/DataBrowserHeaderBar.react';
10-
import Editor from 'dashboard/Data/Browser/Editor.react';
1111
import EmptyState from 'components/EmptyState/EmptyState.react';
1212
import Icon from 'components/Icon/Icon.react';
13+
import { CurrentApp } from 'context/currentApp';
14+
import styles from 'dashboard/Data/Browser/Browser.scss';
15+
import Editor from 'dashboard/Data/Browser/Editor.react';
1316
import Parse from 'parse';
1417
import encode from 'parse/lib/browser/encode';
1518
import React from 'react';
16-
import styles from 'dashboard/Data/Browser/Browser.scss';
17-
import Button from 'components/Button/Button.react';
18-
import { CurrentApp } from 'context/currentApp';
1919

2020
const ROW_HEIGHT = 30;
2121

@@ -560,7 +560,7 @@ export default class BrowserTable extends React.Component {
560560
onResize={this.props.handleResize}
561561
onAddColumn={this.props.onAddColumn}
562562
preventSchemaEdits={this.context.preventSchemaEdits}
563-
isDataLoaded={!this.props.isLoading}
563+
isDataLoaded={!!this.props.data}
564564
setSelectedObjectId={this.props.setSelectedObjectId}
565565
setCurrent={this.props.setCurrent}
566566
/>

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export default class DataBrowser extends React.Component {
192192

193193
if (!this.state.isPanelVisible) {
194194
this.props.setAggregationPanelData({});
195-
this.props.setLoading(false);
195+
this.props.setLoadingInfoPanel(false);
196196
if (this.props.errorAggregatedData != {}) {
197197
this.props.setErrorAggregatedData({});
198198
}
@@ -587,7 +587,7 @@ export default class DataBrowser extends React.Component {
587587

588588
if (newSelection.size > 1) {
589589
this.setCurrent(null);
590-
this.props.setLoading(false);
590+
this.props.setLoadingInfoPanel(false);
591591
this.setState({
592592
selectedCells: {
593593
list: newSelection,

0 commit comments

Comments
 (0)