Skip to content

Commit 5ca8218

Browse files
authored
fix: No individual data loading indicators when displaying multiple info panels (#3026)
1 parent 7a01664 commit 5ca8218

File tree

2 files changed

+27
-11
lines changed

2 files changed

+27
-11
lines changed

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

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ export default class DataBrowser extends React.Component {
133133
panelCount: 1, // Number of panels to display
134134
multiPanelData: {}, // Object mapping objectId to panel data
135135
_objectsToFetch: [], // Temporary field for async fetch handling
136+
loadingObjectIds: new Set(),
136137
};
137138

138139
this.handleResizeDiv = this.handleResizeDiv.bind(this);
@@ -1010,20 +1011,34 @@ export default class DataBrowser extends React.Component {
10101011
};
10111012
const options = { useMasterKey: true };
10121013

1014+
this.setState(prev => ({
1015+
loadingObjectIds: new Set(prev.loadingObjectIds).add(objectId)
1016+
}));
1017+
10131018
Parse.Cloud.run(cloudCodeFunction, params, options).then(result => {
10141019
// Store in both prefetchCache and multiPanelData
1015-
this.setState(prev => ({
1016-
prefetchCache: {
1017-
...prev.prefetchCache,
1018-
[objectId]: { data: result, timestamp: Date.now() }
1019-
},
1020-
multiPanelData: {
1021-
...prev.multiPanelData,
1022-
[objectId]: result
1023-
}
1024-
}));
1020+
this.setState(prev => {
1021+
const newLoading = new Set(prev.loadingObjectIds);
1022+
newLoading.delete(objectId);
1023+
return {
1024+
loadingObjectIds: newLoading,
1025+
prefetchCache: {
1026+
...prev.prefetchCache,
1027+
[objectId]: { data: result, timestamp: Date.now() }
1028+
},
1029+
multiPanelData: {
1030+
...prev.multiPanelData,
1031+
[objectId]: result
1032+
}
1033+
};
1034+
});
10251035
}).catch(error => {
10261036
console.error(`Failed to fetch panel data for ${objectId}:`, error);
1037+
this.setState(prev => {
1038+
const newLoading = new Set(prev.loadingObjectIds);
1039+
newLoading.delete(objectId);
1040+
return { loadingObjectIds: newLoading };
1041+
});
10271042
});
10281043
}
10291044
}
@@ -1470,7 +1485,7 @@ export default class DataBrowser extends React.Component {
14701485
}
14711486
return this.state.displayedObjectIds.map((objectId, index) => {
14721487
const panelData = this.state.multiPanelData[objectId] || {};
1473-
const isLoading = objectId === this.state.selectedObjectId && this.props.isLoadingCloudFunction;
1488+
const isLoading = (objectId === this.state.selectedObjectId && this.props.isLoadingCloudFunction) || this.state.loadingObjectIds.has(objectId);
14741489
const isRowSelected = this.props.selection[objectId];
14751490
return (
14761491
<React.Fragment key={objectId}>

src/dashboard/Data/Browser/Databrowser.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
min-width: 0;
3737
overflow-y: auto;
3838
overflow-x: hidden;
39+
position: relative;
3940

4041
/* Custom narrow scrollbar for webkit browsers */
4142
&::-webkit-scrollbar {

0 commit comments

Comments
 (0)