Skip to content

Commit

Permalink
Fix for selection the first operation on api details page (#918)
Browse files Browse the repository at this point in the history
Fix for selection the first operation on API details page
fix for #863
  • Loading branch information
ygrik authored Sep 15, 2020
1 parent 5d369b2 commit 6f18436
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 60 deletions.
94 changes: 47 additions & 47 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@
"webpack-merge": "^5.1.2"
},
"dependencies": {
"@paperbits/azure": "0.1.318",
"@paperbits/common": "0.1.318",
"@paperbits/core": "0.1.318",
"@paperbits/prosemirror": "0.1.318",
"@paperbits/styles": "0.1.318",
"@paperbits/azure": "0.1.322",
"@paperbits/common": "0.1.322",
"@paperbits/core": "0.1.322",
"@paperbits/prosemirror": "0.1.322",
"@paperbits/styles": "0.1.322",
"@webcomponents/custom-elements": "1.4.2",
"@webcomponents/shadydom": "^1.7.4",
"adal-vanilla": "^1.0.18",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export class OperationDetails {

this.selectedApiName(apiName);
this.selectedOperationName(operationName);
this.router.addRouteChangeListener(this.onRouteChange.bind(this));

if (apiName) {
await this.loadApi(apiName);
Expand All @@ -106,8 +107,6 @@ export class OperationDetails {
if (operationName) {
await this.loadOperation(apiName, operationName);
}

this.router.addRouteChangeListener(this.onRouteChange.bind(this));
}

private async onRouteChange(): Promise<void> {
Expand All @@ -116,16 +115,22 @@ export class OperationDetails {

if (apiName && apiName !== this.selectedApiName()) {
this.selectedApiName(apiName);
this.loadApi(apiName);
await this.loadApi(apiName);
}

if (apiName !== this.selectedApiName() || operationName !== this.selectedOperationName()) {
if (apiName === this.selectedApiName() && operationName === this.selectedOperationName()) {
return;
}

if (!operationName) {
this.selectedOperationName(null);
this.operation(null);
return;
}

if (apiName && operationName) {
this.selectedOperationName(operationName);
await this.loadOperation(apiName, operationName);
}
if (apiName && operationName) {
this.selectedOperationName(operationName);
await this.loadOperation(apiName, operationName);
}
}

Expand Down

0 comments on commit 6f18436

Please sign in to comment.