From cb108848860595e87c084e652f36cdda5a4fc870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marina=20L=C3=B3pez?= Date: Wed, 27 Sep 2023 13:05:02 +0200 Subject: [PATCH] feat(workflows): fix navigation --- .../project-feature-new-workflow.component.ts | 1 - .../project-feature-shell-routing.module.ts | 2 +- .../project-feature-view-setter.component.ts | 23 +++++++++++++------ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/javascript/apps/taiga/src/app/modules/project/feature-new-workflow/project-feature-new-workflow.component.ts b/javascript/apps/taiga/src/app/modules/project/feature-new-workflow/project-feature-new-workflow.component.ts index a1550d55a..4c7b80486 100644 --- a/javascript/apps/taiga/src/app/modules/project/feature-new-workflow/project-feature-new-workflow.component.ts +++ b/javascript/apps/taiga/src/app/modules/project/feature-new-workflow/project-feature-new-workflow.component.ts @@ -67,7 +67,6 @@ export class ProjectFeatureNewWorkflowComponent { public get getPreviousUrl(): string[] { const previousUrl = this.routeHistoryService.getPreviousUrl(); const project = this.state.get('project'); - console.log({ previousUrl }); return previousUrl ? [previousUrl] : [`/project/${project.id}${project.slug}/overview`]; diff --git a/javascript/apps/taiga/src/app/modules/project/feature-shell/project-feature-shell-routing.module.ts b/javascript/apps/taiga/src/app/modules/project/feature-shell/project-feature-shell-routing.module.ts index 147e97ddd..5236a4f4d 100644 --- a/javascript/apps/taiga/src/app/modules/project/feature-shell/project-feature-shell-routing.module.ts +++ b/javascript/apps/taiga/src/app/modules/project/feature-shell/project-feature-shell-routing.module.ts @@ -88,7 +88,7 @@ const routes: Routes = [ canDeactivate: [CanDeactivateGuard], data: { kanban: true, - reuseComponent: true, + reuseComponent: false, }, }, { diff --git a/javascript/apps/taiga/src/app/modules/project/feature-view-setter/project-feature-view-setter.component.ts b/javascript/apps/taiga/src/app/modules/project/feature-view-setter/project-feature-view-setter.component.ts index 2cf1d00e4..6e7eb1839 100644 --- a/javascript/apps/taiga/src/app/modules/project/feature-view-setter/project-feature-view-setter.component.ts +++ b/javascript/apps/taiga/src/app/modules/project/feature-view-setter/project-feature-view-setter.component.ts @@ -41,7 +41,7 @@ import { } from '@angular/router'; import { RxState } from '@rx-angular/state'; import { CommonModule } from '@angular/common'; -import { StoryDetail, StoryView, Project, Story } from '@taiga/data'; +import { StoryDetail, StoryView, Project, Story, Workflow } from '@taiga/data'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; interface ProjectFeatureViewSetterComponentState { @@ -99,11 +99,6 @@ export class ProjectFeatureViewSetterComponent implements OnDestroy { ) ); - this.state.connect( - 'isKanban', - this.state.select('url').pipe(map((url) => url.endsWith('/kanban'))) - ); - this.state.hold( this.state.select('kanbanHost').pipe(distinctUntilChanged(), filterNil()), (host) => { @@ -128,7 +123,21 @@ export class ProjectFeatureViewSetterComponent implements OnDestroy { ]) .pipe(takeUntilDestroyed(this.destroyRef)) .subscribe(([url, data, params]) => { - if (!url.endsWith('/kanban') && !!data.stories) { + this.state.connect( + 'isKanban', + this.state + .select('url') + .pipe( + map((url) => + url.endsWith(`/kanban/${params.workflow as Workflow['slug']}`) + ) + ) + ); + + if ( + !url.endsWith(`/kanban/${params.workflow as Workflow['slug']}`) && + !!data.stories + ) { const storyParams = params as StoryParams; const needRedirect = params.slug !== (data.project as Project).slug; if (needRedirect) {