@@ -50,9 +50,6 @@ export class ProjectClient {
50
50
51
51
constructor ( client : WebappClient ) {
52
52
this . client = client ;
53
- this . ipywidgetsGetBuffer = reuseInFlight (
54
- this . ipywidgetsGetBuffer . bind ( this ) ,
55
- ) ;
56
53
}
57
54
58
55
private async call ( message : object ) : Promise < any > {
@@ -380,16 +377,19 @@ export class ProjectClient {
380
377
}
381
378
382
379
// This is async, so do "await smc_webapp.configuration(...project_id...)".
383
- public async configuration (
384
- project_id : string ,
385
- aspect : ConfigurationAspect ,
386
- no_cache : boolean ,
387
- ) : Promise < Configuration > {
388
- if ( ! is_valid_uuid_string ( project_id ) ) {
389
- throw Error ( "project_id must be a valid uuid" ) ;
390
- }
391
- return ( await this . api ( project_id ) ) . configuration ( aspect , no_cache ) ;
392
- }
380
+ // for reuseInFlight, see https://github.com/sagemathinc/cocalc/issues/7806
381
+ public configuration = reuseInFlight (
382
+ async (
383
+ project_id : string ,
384
+ aspect : ConfigurationAspect ,
385
+ no_cache : boolean ,
386
+ ) : Promise < Configuration > => {
387
+ if ( ! is_valid_uuid_string ( project_id ) ) {
388
+ throw Error ( "project_id must be a valid uuid" ) ;
389
+ }
390
+ return ( await this . api ( project_id ) ) . configuration ( aspect , no_cache ) ;
391
+ } ,
392
+ ) ;
393
393
394
394
// Remove all upgrades from all projects that this user collaborates on.
395
395
public async remove_all_upgrades ( projects ?: string [ ] ) : Promise < void > {
@@ -543,29 +543,30 @@ export class ProjectClient {
543
543
return get_usage_info ( project_id ) ;
544
544
}
545
545
546
- // NOTE: we reuseInFlight this in the constructor.
547
- public async ipywidgetsGetBuffer (
548
- project_id : string ,
549
- path : string ,
550
- model_id : string ,
551
- buffer_path : string ,
552
- useHttp ?: boolean , // ONLY works for home base, NOT compute servers!
553
- ) : Promise < ArrayBuffer > {
554
- if ( useHttp ) {
555
- const url = ipywidgetsGetBufferUrl (
556
- project_id ,
557
- path ,
546
+ public ipywidgetsGetBuffer = reuseInFlight (
547
+ async (
548
+ project_id : string ,
549
+ path : string ,
550
+ model_id : string ,
551
+ buffer_path : string ,
552
+ useHttp ?: boolean , // ONLY works for home base, NOT compute servers!
553
+ ) : Promise < ArrayBuffer > => {
554
+ if ( useHttp ) {
555
+ const url = ipywidgetsGetBufferUrl (
556
+ project_id ,
557
+ path ,
558
+ model_id ,
559
+ buffer_path ,
560
+ ) ;
561
+ return await ( await fetch ( url ) ) . arrayBuffer ( ) ;
562
+ }
563
+ const actions = redux . getEditorActions ( project_id , path ) ;
564
+ return await actions . jupyter_actions . ipywidgetsGetBuffer (
558
565
model_id ,
559
566
buffer_path ,
560
567
) ;
561
- return await ( await fetch ( url ) ) . arrayBuffer ( ) ;
562
- }
563
- const actions = redux . getEditorActions ( project_id , path ) ;
564
- return await actions . jupyter_actions . ipywidgetsGetBuffer (
565
- model_id ,
566
- buffer_path ,
567
- ) ;
568
- }
568
+ } ,
569
+ ) ;
569
570
570
571
// getting, setting, editing, deleting, etc., the api keys for a project
571
572
public async api_keys ( opts : {
0 commit comments