Skip to content

Commit c8a650b

Browse files
authored
fix: Back to keymap link disappeared when saved or cancelled macro action item (#2353)
1 parent c1f889d commit c8a650b

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

packages/uhk-web/src/app/components/back-to/back-to.component.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnDestroy } from '@angular/core';
1+
import { ChangeDetectorRef, Component, OnDestroy } from '@angular/core';
22
import { ActivatedRoute } from '@angular/router';
33
import { Subscription } from 'rxjs';
44

@@ -17,7 +17,8 @@ export class BackToComponent implements OnDestroy {
1717

1818
private routeSubscription: Subscription;
1919

20-
constructor(private route: ActivatedRoute) {
20+
constructor(private route: ActivatedRoute,
21+
private cdRef: ChangeDetectorRef) {
2122
this.routeSubscription = route.queryParams.subscribe(params => {
2223
if (params.backUrl) {
2324
const backUrl = new URL(params.backUrl, window.location.origin);
@@ -30,6 +31,8 @@ export class BackToComponent implements OnDestroy {
3031
} else {
3132
this.backUrl = undefined;
3233
}
34+
35+
cdRef.markForCheck();
3336
});
3437
}
3538

packages/uhk-web/src/app/components/macro/edit/macro-edit.component.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ export class MacroEditComponent implements OnDestroy {
6161

6262
@ViewChild(SplitComponent) split: SplitComponent;
6363

64+
private backUrl: string;
65+
private backUrlText: string;
6466
private subscriptions = new Subscription();
6567

6668
constructor(private store: Store<AppState>,
@@ -89,6 +91,9 @@ export class MacroEditComponent implements OnDestroy {
8991
this.smartMacroDocUrl$ = store.select(selectSmartMacroDocUrl);
9092
this.smartMacroPanelVisibility$ = store.select(getSmartMacroPanelVisibility);
9193
this.subscriptions.add(this.route.queryParams.subscribe(params => {
94+
this.backUrl = params.backUrl;
95+
this.backUrlText = params.backText;
96+
9297
if (params.actionIndex) {
9398
if (params.actionIndex === 'new') {
9499
this.selectedMacroActionIdModel = {
@@ -146,6 +151,8 @@ export class MacroEditComponent implements OnDestroy {
146151
this.router.navigate([], {
147152
queryParams: {
148153
actionIndex: model?.id,
154+
backText: this.backUrlText,
155+
backUrl: this.backUrl,
149156
inlineEdit: model?.inlineEdit
150157
}
151158
});
@@ -173,7 +180,12 @@ export class MacroEditComponent implements OnDestroy {
173180

174181
private hideActiveEditor(): void {
175182
if (!this.selectedMacroActionIdModel?.inlineEdit) {
176-
this.router.navigate([]);
183+
this.router.navigate([], {
184+
queryParams: {
185+
backText: this.backUrlText,
186+
backUrl: this.backUrl,
187+
},
188+
});
177189
}
178190
}
179191
}

0 commit comments

Comments
 (0)