@@ -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 } >
0 commit comments