Skip to content

fix: Data browser table shows loading indicator when info panel is loading #2782

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/AggregationPanel/AggregationPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const AggregationPanel = ({
}
}, [errorAggregatedData, setSelectedObjectId, setErrorAggregatedData]);

const isLoading = useMemo(
const isLoadingInfoPanel = useMemo(
() => depth === 0 && selectedObjectId && isLoadingCloudFunction && showAggregatedData,
[depth, selectedObjectId, isLoadingCloudFunction, showAggregatedData]
);
Expand Down Expand Up @@ -181,7 +181,7 @@ const AggregationPanel = ({

return (
<div className={styles.aggregationPanel}>
{isLoading ? (
{isLoadingInfoPanel ? (
<div className={styles.center}>
<LoaderDots />
</div>
Expand Down
26 changes: 11 additions & 15 deletions src/dashboard/Data/Browser/Browser.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class Browser extends DashboardView {
configData: {},
classwiseCloudFunctions: {},
AggregationPanelData: {},
isLoading: false,
isLoadingInfoPanel: false,
errorAggregatedData: {},
};

Expand All @@ -130,7 +130,7 @@ class Browser extends DashboardView {
this.showExport = this.showExport.bind(this);
this.login = this.login.bind(this);
this.logout = this.logout.bind(this);
this.setLoading = this.setLoading.bind(this);
this.setLoadingInfoPanel = this.setLoadingInfoPanel.bind(this);
this.setErrorAggregatedData = this.setErrorAggregatedData.bind(this);
this.toggleMasterKeyUsage = this.toggleMasterKeyUsage.bind(this);
this.showAttachRowsDialog = this.showAttachRowsDialog.bind(this);
Expand Down Expand Up @@ -255,9 +255,9 @@ class Browser extends DashboardView {
}
}

setLoading(bool) {
setLoadingInfoPanel(bool) {
this.setState({
isLoading: bool,
isLoadingInfoPanel: bool,
});
}

Expand All @@ -269,7 +269,7 @@ class Browser extends DashboardView {

fetchAggregationPanelData(objectId, className, appId) {
this.setState({
isLoading: true,
isLoadingInfoPanel: true,
});
const params = {
object: Parse.Object.extend(className).createWithoutData(objectId).toPointer(),
Expand All @@ -283,18 +283,18 @@ class Browser extends DashboardView {
Parse.Cloud.run(cloudCodeFunction, params, options).then(
result => {
if (result && result.panel && result.panel && result.panel.segments) {
this.setState({ AggregationPanelData: result, isLoading: false });
this.setState({ AggregationPanelData: result, isLoadingInfoPanel: false });
} else {
this.setState({
isLoading: false,
isLoadingInfoPanel: false,
errorAggregatedData: 'Improper JSON format',
});
this.showNote(this.state.errorAggregatedData, true);
}
},
error => {
this.setState({
isLoading: false,
isLoadingInfoPanel: false,
errorAggregatedData: error.message,
});
this.showNote(this.state.errorAggregatedData, true);
Expand Down Expand Up @@ -898,7 +898,6 @@ class Browser extends DashboardView {

async fetchParseData(source, filters) {
const { useMasterKey, skip, limit } = this.state;
this.setLoading(true);
this.setState({
data: null,
})
Expand Down Expand Up @@ -931,8 +930,6 @@ class Browser extends DashboardView {
this.setState({ isUnique, uniqueField });

const data = await promise;

this.setLoading(false);
return data;
}

Expand Down Expand Up @@ -1121,7 +1118,7 @@ class Browser extends DashboardView {
ordering: ordering,
selection: {},
errorAggregatedData: {},
isLoading: false,
isLoadingInfoPanel: false,
AggregationPanelData: {},
},
() => this.fetchData(source, this.state.filters)
Expand Down Expand Up @@ -2098,9 +2095,8 @@ class Browser extends DashboardView {
classes={this.classes}
classwiseCloudFunctions={this.state.classwiseCloudFunctions}
callCloudFunction={this.fetchAggregationPanelData}
isLoadingCloudFunction={this.state.isLoading}
isLoading={this.state.isLoading}
setLoading={this.setLoading}
isLoadingCloudFunction={this.state.isLoadingInfoPanel}
setLoadingInfoPanel={this.setLoadingInfoPanel}
AggregationPanelData={this.state.AggregationPanelData}
setAggregationPanelData={this.setAggregationPanelData}
setErrorAggregatedData={this.setErrorAggregatedData}
Expand Down
10 changes: 5 additions & 5 deletions src/dashboard/Data/Browser/BrowserTable.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
* the root directory of this source tree.
*/
import BrowserRow from 'components/BrowserRow/BrowserRow.react';
import Button from 'components/Button/Button.react';
import DataBrowserHeaderBar from 'components/DataBrowserHeaderBar/DataBrowserHeaderBar.react';
import Editor from 'dashboard/Data/Browser/Editor.react';
import EmptyState from 'components/EmptyState/EmptyState.react';
import Icon from 'components/Icon/Icon.react';
import { CurrentApp } from 'context/currentApp';
import styles from 'dashboard/Data/Browser/Browser.scss';
import Editor from 'dashboard/Data/Browser/Editor.react';
import Parse from 'parse';
import encode from 'parse/lib/browser/encode';
import React from 'react';
import styles from 'dashboard/Data/Browser/Browser.scss';
import Button from 'components/Button/Button.react';
import { CurrentApp } from 'context/currentApp';

const ROW_HEIGHT = 30;

Expand Down Expand Up @@ -560,7 +560,7 @@ export default class BrowserTable extends React.Component {
onResize={this.props.handleResize}
onAddColumn={this.props.onAddColumn}
preventSchemaEdits={this.context.preventSchemaEdits}
isDataLoaded={!this.props.isLoading}
isDataLoaded={!!this.props.data}
setSelectedObjectId={this.props.setSelectedObjectId}
setCurrent={this.props.setCurrent}
/>
Expand Down
4 changes: 2 additions & 2 deletions src/dashboard/Data/Browser/DataBrowser.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export default class DataBrowser extends React.Component {

if (!this.state.isPanelVisible) {
this.props.setAggregationPanelData({});
this.props.setLoading(false);
this.props.setLoadingInfoPanel(false);
if (this.props.errorAggregatedData != {}) {
this.props.setErrorAggregatedData({});
}
Expand Down Expand Up @@ -587,7 +587,7 @@ export default class DataBrowser extends React.Component {

if (newSelection.size > 1) {
this.setCurrent(null);
this.props.setLoading(false);
this.props.setLoadingInfoPanel(false);
this.setState({
selectedCells: {
list: newSelection,
Expand Down
Loading