-
Notifications
You must be signed in to change notification settings - Fork 4
[NAE-2202] Post test fixes #298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
79f0772
f77f055
924ab41
94051f4
50d6477
cb92143
e6c56e1
eec0fa0
354bee6
a022691
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -94,7 +94,7 @@ export class DoubleDrawerNavigationService implements OnDestroy { | |||||||||||||
protected _redirectService: RedirectService, | ||||||||||||||
protected _pathService: PathService, | ||||||||||||||
protected _userService: UserService, | ||||||||||||||
) { | ||||||||||||||
) { | ||||||||||||||
this._leftItems$ = new BehaviorSubject([]); | ||||||||||||||
this._rightItems$ = new BehaviorSubject([]); | ||||||||||||||
this._moreItems$ = new BehaviorSubject([]); | ||||||||||||||
|
@@ -439,6 +439,8 @@ export class DoubleDrawerNavigationService implements OnDestroy { | |||||||||||||
this.resolveCustomViewsInRightSide(); | ||||||||||||||
this._rightLoading$.off(); | ||||||||||||||
this.itemLoaded.emit({menu: 'right', items: this.rightItems}); | ||||||||||||||
|
||||||||||||||
this.openAvailableView(); | ||||||||||||||
}, error => { | ||||||||||||||
Comment on lines
+442
to
444
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainAvoid double auto-open triggers.
Minimal change: rely on the post-load call and remove the subscription. - this._rightLoading$.pipe(
- filter(isRightLoading => isRightLoading === false),
- take(1)
- ).subscribe(() => {
- this.openAvailableView();
- })
+ // Auto-open is handled in loadRightSide() after items finish loading. Run to find other call sites to confirm no remaining duplicates: Also applies to: 269-275 🏁 Script executed: #!/bin/bash
rg -n "openAvailableView\\(" -C2 Length of output: 3958 🏁 Script executed: #!/bin/bash
sed -n '250,340p' projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts Length of output: 4357 🏁 Script executed: #!/bin/bash
sed -n '120,160p' projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/abstract-navigation-double-drawer.ts Length of output: 1550 🏁 Script executed: #!/bin/bash
sed -n '400,480p' projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts Length of output: 3484 🏁 Script executed: #!/bin/bash
rg -n "protected loadLeftSide" -C3 projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts Length of output: 237 🏁 Script executed: #!/bin/bash
sed -n '1,120p' projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts Length of output: 5236 Remove duplicate auto-open in onItemClick - this._rightLoading$.pipe(
- filter(isRightLoading => isRightLoading === false),
- take(1)
- ).subscribe(() => {
- this.openAvailableView();
- })
+ // auto-open is handled in loadRightSide() after items finish loading 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||
this._log.error(error); | ||||||||||||||
this._rightItems$.next([]); | ||||||||||||||
|
@@ -492,7 +494,7 @@ export class DoubleDrawerNavigationService implements OnDestroy { | |||||||||||||
const resolvedBannedRoles = DoubleDrawerUtils.resolveAccessRoles(itemCase, GroupNavigationConstants.ITEM_FIELD_ID_BANNED_ROLES); | ||||||||||||||
if (!!resolvedRoles) item.access['role'] = resolvedRoles; | ||||||||||||||
if (!!resolvedBannedRoles) item.access['bannedRole'] = resolvedBannedRoles; | ||||||||||||||
if (!this._accessService.canAccessView(item, item.routingPath)) return; | ||||||||||||||
if (!this._accessService.canAccessView(item, item.routing?.path)) return; | ||||||||||||||
return item; | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
|
@@ -545,7 +547,8 @@ export class DoubleDrawerNavigationService implements OnDestroy { | |||||||||||||
public getItemRoutingPath(itemCase: Case) { | ||||||||||||||
const taskId = DoubleDrawerUtils.findTaskIdInCase(itemCase, SETTINGS_TRANSITION_ID); | ||||||||||||||
const url = this._dynamicRoutingService.route; | ||||||||||||||
return `/${url}/${taskId}`; | ||||||||||||||
const prefix = url.startsWith('/') ? '' : '/'; | ||||||||||||||
return `${prefix}${url}/${taskId}`; | ||||||||||||||
} | ||||||||||||||
machacjozef marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
|
||||||||||||||
private processLeftItems(cases: Case[], orderedChildCaseIds: string[]): NavigationItem[] { | ||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -42,6 +42,7 @@ export class CaseProcess extends NoConfigurationAutocompleteCategory<string> { | |||||||||||||||||||||
|
||||||||||||||||||||||
this._allowedNetsSub = this._optionalDependencies.allowedNetsService.allowedNets$.subscribe(allowedNets => { | ||||||||||||||||||||||
this._optionsMap.clear(); | ||||||||||||||||||||||
Comment on lines
43
to
44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Guard against duplicate subscriptions If createOptions can be called multiple times, unsubscribe before resubscribing to avoid leaks/duplicate updates. - this._allowedNetsSub = this._optionalDependencies.allowedNetsService.allowedNets$.subscribe(allowedNets => {
+ if (this._allowedNetsSub && !this._allowedNetsSub.closed) {
+ this._allowedNetsSub.unsubscribe();
+ }
+ this._allowedNetsSub = this._optionalDependencies.allowedNetsService.allowedNets$.subscribe(allowedNets => { 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||
this._uniqueOptionsMap.clear(); | ||||||||||||||||||||||
allowedNets.forEach(petriNet => { | ||||||||||||||||||||||
if (this.isUniqueOption(petriNet.title, petriNet.identifier)) { | ||||||||||||||||||||||
this.addToMap(petriNet.title, petriNet.identifier); | ||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Scope and de-duplicate auto-open to avoid surprise navigation and loops
Else-branch now calls openAvailableView() whenever activePath$ re-emits the same value. This bypasses the earlier canApplyAutoSelect() guard (used below on rightItems$) and can:
Guard by (a) scoping to canApplyAutoSelect(), (b) ensuring right items are available, and (c) making it one-shot per path.
Apply this diff within the subscription:
Add this helper field to the class (near other protected fields):
Verification suggestions:
Do you want me to add a focused unit test that asserts a single openAvailableView() invocation when activePath$ re-emits the same value?
Also applies to: 136-143
🏁 Script executed:
Length of output: 8795
🏁 Script executed:
Length of output: 8392
Guard and de-duplicate auto-open in AbstractNavigationDoubleDrawerComponent
Add a one-shot flag and apply the guard in the
activePath$
subscription to prevent unintended loops and bypassing ofcanApplyAutoSelect()
:Near the other protected fields, add:
In the
activePath$
subscription (lines 129–133), replace:with:
Apply a similar one-shot guard to the
rightItems$
subscription (lines 136–143) if auto-open should only ever fire once per path.Would you like a focused unit test that asserts
openAvailableView()
is invoked exactly once whenactivePath$
re-emits the same value?🤖 Prompt for AI Agents