@@ -263,7 +263,7 @@ class Browser extends DashboardView {
263
263
this . fetchAggregationPanelData = this . fetchAggregationPanelData . bind ( this ) ;
264
264
this . setAggregationPanelData = this . setAggregationPanelData . bind ( this ) ;
265
265
266
- // Reference to cancel the ongoing info panel cloud function request
266
+ // Handle for the ongoing info panel cloud function request
267
267
this . currentInfoPanelQuery = null ;
268
268
269
269
this . dataBrowserRef = React . createRef ( ) ;
@@ -303,7 +303,7 @@ class Browser extends DashboardView {
303
303
this . currentQuery . cancel ( ) ;
304
304
}
305
305
if ( this . currentInfoPanelQuery ) {
306
- this . currentInfoPanelQuery . cancel ( ) ;
306
+ this . currentInfoPanelQuery . abort ( ) ;
307
307
this . currentInfoPanelQuery = null ;
308
308
}
309
309
this . removeLocation ( ) ;
@@ -354,7 +354,7 @@ class Browser extends DashboardView {
354
354
355
355
fetchAggregationPanelData ( objectId , className , appId ) {
356
356
if ( this . currentInfoPanelQuery ) {
357
- this . currentInfoPanelQuery . cancel ( ) ;
357
+ this . currentInfoPanelQuery . abort ( ) ;
358
358
this . currentInfoPanelQuery = null ;
359
359
}
360
360
@@ -365,18 +365,25 @@ class Browser extends DashboardView {
365
365
const params = {
366
366
object : Parse . Object . extend ( className ) . createWithoutData ( objectId ) . toPointer ( ) ,
367
367
} ;
368
+ let requestTask ;
368
369
const options = {
369
370
useMasterKey : true ,
371
+ requestTask : task => {
372
+ requestTask = task ;
373
+ } ,
370
374
} ;
371
375
const appName = this . props . params . appId ;
372
376
const cloudCodeFunction =
373
377
this . state . classwiseCloudFunctions [ `${ appId } ${ appName } ` ] ?. [ className ] [ 0 ] . cloudCodeFunction ;
374
378
375
379
const promise = Parse . Cloud . run ( cloudCodeFunction , params , options ) ;
376
- this . currentInfoPanelQuery = promise ;
380
+ this . currentInfoPanelQuery = {
381
+ abort : ( ) => requestTask ?. abort ( ) ,
382
+ promise,
383
+ } ;
377
384
promise . then (
378
385
result => {
379
- if ( this . currentInfoPanelQuery !== promise ) {
386
+ if ( this . currentInfoPanelQuery ?. promise !== promise ) {
380
387
return ;
381
388
}
382
389
if ( result && result . panel && result . panel && result . panel . segments ) {
@@ -390,7 +397,7 @@ class Browser extends DashboardView {
390
397
}
391
398
} ,
392
399
error => {
393
- if ( this . currentInfoPanelQuery !== promise ) {
400
+ if ( this . currentInfoPanelQuery ?. promise !== promise ) {
394
401
return ;
395
402
}
396
403
this . setState ( {
@@ -400,7 +407,7 @@ class Browser extends DashboardView {
400
407
this . showNote ( this . state . errorAggregatedData , true ) ;
401
408
}
402
409
) . finally ( ( ) => {
403
- if ( this . currentInfoPanelQuery === promise ) {
410
+ if ( this . currentInfoPanelQuery ?. promise === promise ) {
404
411
this . currentInfoPanelQuery = null ;
405
412
}
406
413
} ) ;
0 commit comments