From d3aa134e2b95dd45c194367e29066f77ab5a6549 Mon Sep 17 00:00:00 2001 From: Roman Nastyuk Date: Thu, 14 Aug 2025 16:21:24 +0300 Subject: [PATCH 1/4] fix(linked-projects): fixed linked resources state update bug --- .../link-resource-dialog.component.ts | 7 +++++-- .../shared/stores/node-links/node-links.state.ts | 15 ++++----------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/app/features/project/overview/components/link-resource-dialog/link-resource-dialog.component.ts b/src/app/features/project/overview/components/link-resource-dialog/link-resource-dialog.component.ts index 9b8cb87d0..a4df82fe4 100644 --- a/src/app/features/project/overview/components/link-resource-dialog/link-resource-dialog.component.ts +++ b/src/app/features/project/overview/components/link-resource-dialog/link-resource-dialog.component.ts @@ -9,7 +9,7 @@ import { DynamicDialogRef } from 'primeng/dynamicdialog'; import { Skeleton } from 'primeng/skeleton'; import { TableModule, TablePageEvent } from 'primeng/table'; -import { debounceTime, distinctUntilChanged } from 'rxjs'; +import { debounceTime, distinctUntilChanged, switchMap } from 'rxjs'; import { DatePipe, NgClass } from '@angular/common'; import { @@ -181,7 +181,10 @@ export class LinkResourceDialogComponent { this.actions.deleteNodeLink(currentProjectId, linkToDelete); } else { - this.actions.createNodeLink(currentProjectId, resource); + this.actions + .createNodeLink(currentProjectId, resource) + .pipe(switchMap(() => this.actions.getLinkedProjects(currentProjectId))) + .subscribe(); } } diff --git a/src/app/shared/stores/node-links/node-links.state.ts b/src/app/shared/stores/node-links/node-links.state.ts index 4dc0f5383..4eb9ef169 100644 --- a/src/app/shared/stores/node-links/node-links.state.ts +++ b/src/app/shared/stores/node-links/node-links.state.ts @@ -27,17 +27,9 @@ export class NodeLinksState { }, }); - return this.nodeLinksService.createNodeLink(action.currentProjectId, action.resource).pipe( - tap(() => { - ctx.patchState({ - linkedResources: { - ...state.linkedResources, - isSubmitting: false, - }, - }); - }), - catchError((error) => this.handleError(ctx, 'linkedResources', error)) - ); + return this.nodeLinksService + .createNodeLink(action.currentProjectId, action.resource) + .pipe(catchError((error) => this.handleError(ctx, 'linkedResources', error))); } @Action(GetLinkedResources) @@ -60,6 +52,7 @@ export class NodeLinksState { linkedResources: { data: combinedResources, isLoading: false, + isSubmitting: false, error: null, }, }); From 01b1962ba1c0db0ede426ef3cbd27ea78e47f8c9 Mon Sep 17 00:00:00 2001 From: Roman Nastyuk Date: Thu, 14 Aug 2025 16:26:48 +0300 Subject: [PATCH 2/4] fix(linked-projects): commented out pre-push --- .husky/pre-push | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.husky/pre-push b/.husky/pre-push index 06ca98983..c7f01c3f0 100644 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,19 +1,19 @@ # npm run build -npm run test:coverage || { - printf "\n\nERROR: Testing errors or coverage issues were found." - printf "\n\nIn the future this will block your ability to push to github until it is resolved." - printf "\n\nThe same pipeline runs on github." - printf "\n\nYou are seeing this error because code was added without test coverage." +#npm run test:coverage || { +# printf "\n\nERROR: Testing errors or coverage issues were found." +# printf "\n\nIn the future this will block your ability to push to github until it is resolved." +# printf "\n\nThe same pipeline runs on github." +# printf "\n\nYou are seeing this error because code was added without test coverage." # printf "\n\n Please address them before proceeding.\n\n\n\n" # exit 1 -} +# } -npm run test:check-coverage-thresholds || { - printf "\n\nERROR: Coverage thresholds were not met." - printf "\n\nIn the future this will block your ability to push to github until it is resolved." - printf "\n\nThe same pipeline runs on github." - printf "\n\nYou are seeing this error because test coverage increased without updating the jest.config.js thresholds." +#npm run test:check-coverage-thresholds || { +# printf "\n\nERROR: Coverage thresholds were not met." +# printf "\n\nIn the future this will block your ability to push to github until it is resolved." +# printf "\n\nThe same pipeline runs on github." +# printf "\n\nYou are seeing this error because test coverage increased without updating the jest.config.js thresholds." #printf "\n\nPlease address them before proceeding.\n\n\n\n" # exit 1 -} +#} From 3bbe27d09f353a1d42f4c21d2f32b4b83ba8eb49 Mon Sep 17 00:00:00 2001 From: Roman Nastyuk Date: Thu, 14 Aug 2025 16:46:36 +0300 Subject: [PATCH 3/4] fix(linked-projects): removed commented out pre-push --- .husky/pre-push | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.husky/pre-push b/.husky/pre-push index c7f01c3f0..06ca98983 100644 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,19 +1,19 @@ # npm run build -#npm run test:coverage || { -# printf "\n\nERROR: Testing errors or coverage issues were found." -# printf "\n\nIn the future this will block your ability to push to github until it is resolved." -# printf "\n\nThe same pipeline runs on github." -# printf "\n\nYou are seeing this error because code was added without test coverage." +npm run test:coverage || { + printf "\n\nERROR: Testing errors or coverage issues were found." + printf "\n\nIn the future this will block your ability to push to github until it is resolved." + printf "\n\nThe same pipeline runs on github." + printf "\n\nYou are seeing this error because code was added without test coverage." # printf "\n\n Please address them before proceeding.\n\n\n\n" # exit 1 -# } +} -#npm run test:check-coverage-thresholds || { -# printf "\n\nERROR: Coverage thresholds were not met." -# printf "\n\nIn the future this will block your ability to push to github until it is resolved." -# printf "\n\nThe same pipeline runs on github." -# printf "\n\nYou are seeing this error because test coverage increased without updating the jest.config.js thresholds." +npm run test:check-coverage-thresholds || { + printf "\n\nERROR: Coverage thresholds were not met." + printf "\n\nIn the future this will block your ability to push to github until it is resolved." + printf "\n\nThe same pipeline runs on github." + printf "\n\nYou are seeing this error because test coverage increased without updating the jest.config.js thresholds." #printf "\n\nPlease address them before proceeding.\n\n\n\n" # exit 1 -#} +} From 8baed04b95e9766a66edd7030efd34a13a9a65cb Mon Sep 17 00:00:00 2001 From: Roman Nastyuk Date: Thu, 14 Aug 2025 17:06:09 +0300 Subject: [PATCH 4/4] fix(linked-projects): moved get linked recources action dispatch from component to state file --- .../link-resource-dialog.component.ts | 7 ++----- src/app/shared/stores/node-links/node-links.state.ts | 9 ++++++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/features/project/overview/components/link-resource-dialog/link-resource-dialog.component.ts b/src/app/features/project/overview/components/link-resource-dialog/link-resource-dialog.component.ts index a4df82fe4..9b8cb87d0 100644 --- a/src/app/features/project/overview/components/link-resource-dialog/link-resource-dialog.component.ts +++ b/src/app/features/project/overview/components/link-resource-dialog/link-resource-dialog.component.ts @@ -9,7 +9,7 @@ import { DynamicDialogRef } from 'primeng/dynamicdialog'; import { Skeleton } from 'primeng/skeleton'; import { TableModule, TablePageEvent } from 'primeng/table'; -import { debounceTime, distinctUntilChanged, switchMap } from 'rxjs'; +import { debounceTime, distinctUntilChanged } from 'rxjs'; import { DatePipe, NgClass } from '@angular/common'; import { @@ -181,10 +181,7 @@ export class LinkResourceDialogComponent { this.actions.deleteNodeLink(currentProjectId, linkToDelete); } else { - this.actions - .createNodeLink(currentProjectId, resource) - .pipe(switchMap(() => this.actions.getLinkedProjects(currentProjectId))) - .subscribe(); + this.actions.createNodeLink(currentProjectId, resource); } } diff --git a/src/app/shared/stores/node-links/node-links.state.ts b/src/app/shared/stores/node-links/node-links.state.ts index 4eb9ef169..b619970a2 100644 --- a/src/app/shared/stores/node-links/node-links.state.ts +++ b/src/app/shared/stores/node-links/node-links.state.ts @@ -27,9 +27,12 @@ export class NodeLinksState { }, }); - return this.nodeLinksService - .createNodeLink(action.currentProjectId, action.resource) - .pipe(catchError((error) => this.handleError(ctx, 'linkedResources', error))); + return this.nodeLinksService.createNodeLink(action.currentProjectId, action.resource).pipe( + tap(() => { + ctx.dispatch(new GetLinkedResources(action.currentProjectId)); + }), + catchError((error) => this.handleError(ctx, 'linkedResources', error)) + ); } @Action(GetLinkedResources)