Better fix for unfurler race condition

This commit is contained in:
Mononaut
2022-08-31 17:24:56 +00:00
parent 5300f84e77
commit 8bd4fcdab6
8 changed files with 56 additions and 46 deletions

View File

@@ -42,9 +42,9 @@ export class NodePreviewComponent implements OnInit {
this.node$ = this.activatedRoute.paramMap
.pipe(
switchMap((params: ParamMap) => {
this.openGraphService.waitFor('node-map');
this.openGraphService.waitFor('node-data');
this.publicKey = params.get('public_key');
this.publicKey = params.get('public_key');
this.openGraphService.waitFor('node-map-' + this.publicKey);
this.openGraphService.waitFor('node-data-' + this.publicKey);
return this.lightningApiService.getNode$(params.get('public_key'));
}),
map((node) => {
@@ -75,14 +75,14 @@ export class NodePreviewComponent implements OnInit {
this.socketTypes = Object.keys(socketTypesMap);
node.avgCapacity = node.capacity / Math.max(1, node.active_channel_count);
this.openGraphService.waitOver('node-data');
this.openGraphService.waitOver('node-data-' + this.publicKey);
return node;
}),
catchError(err => {
this.error = err;
this.openGraphService.fail('node-map');
this.openGraphService.fail('node-data');
this.openGraphService.fail('node-map-' + this.publicKey);
this.openGraphService.fail('node-data-' + this.publicKey);
return [{
alias: this.publicKey,
public_key: this.publicKey,
@@ -100,6 +100,6 @@ export class NodePreviewComponent implements OnInit {
}
onMapReady() {
this.openGraphService.waitOver('node-map');
this.openGraphService.waitOver('node-map-' + this.publicKey);
}
}