Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2808,16 +2808,25 @@ export class FlowEffects {
{ dispatch: false }
);

leaveProcessGroup$ = createEffect(
() =>
this.actions$.pipe(
ofType(FlowActions.leaveProcessGroup),
concatLatestFrom(() => this.store.select(selectParentProcessGroupId)),
filter(([, parentProcessGroupId]) => parentProcessGroupId != null),
tap(([, parentProcessGroupId]) => {
this.router.navigate(['/process-groups', parentProcessGroupId]);
})
),
leaveProcessGroup$ = createEffect(() =>
this.actions$.pipe(
ofType(FlowActions.leaveProcessGroup),
concatLatestFrom(() => [
this.store.select(selectParentProcessGroupId).pipe(isDefinedAndNotNull()),
this.store.select(selectCurrentProcessGroupId).pipe(isDefinedAndNotNull()),
]),
tap(([,parentProcessGroupId, currentProcessGroupId]) => {
this.store.dispatch(
FlowActions.navigateWithoutTransform({ url: [
'process-groups',
parentProcessGroupId,
ComponentType.ProcessGroup,
currentProcessGroupId
]
})
)
}),
),
{ dispatch: false }
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export class Canvas implements OnInit, OnDestroy {
if (skipTransform) {
this.store.dispatch(setSkipTransform({ skipTransform: false }));
} else {
this.store.dispatch(centerSelectedComponents({ request: { allowTransition } }));
this.store.dispatch(restoreViewport());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is problematic. This was the concern I mentioned initially though the example I gave was wrong. It's removes centering behavior and replaces it with restoring the most recent viewport. An example of a sequence where this becomes an issue is when using the Search capabilities to find another component on the canvas in the current Process Group that is currently out of view. Attempting to navigate to the component through the search results won't work since the user is already centered on the current viewport.

This change shouldn't be needed though but I think I understand why it was included. This sequence will fire twice... once for when the route changes and once for when the store is reloaded (because we're changing Process Groups). These both fire independently/separately. As a result, the Process Group is centering when that wasn't the intent. I would need to consider this scenario more carefully. Other instances of navigateWithoutTransform happen within the current Process Group so the current Process Group doesn't fire and doesn't showcase this issue.

}
});

Expand Down