From dbc0c3152549840d8d889b96fc3285535d71a1b1 Mon Sep 17 00:00:00 2001 From: Jay Date: Fri, 1 Nov 2024 10:40:36 +0100 Subject: [PATCH] =?UTF-8?q?fix(proposal=5Flogbook):=20inifinite=20logbook?= =?UTF-8?q?=20fech=20loop=20after=20RxJS=20upgrade=E2=80=A6=20(#1625)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(proposal_logbook): inifinite logbook fech loop after RxJS upgrade to v7.4.0 * Exclude cy.js from typescript compiler --- cypress/e2e/datasets/datasets-attachment.cy.js | 1 - cypress/e2e/datasets/datasets-datafiles.cy.js | 2 -- cypress/e2e/datasets/datasets-general.cy.js | 2 -- cypress/e2e/datasets/datasets-keyword.cy.js | 2 -- cypress/e2e/datasets/datasets-metadata.cy.js | 2 -- cypress/e2e/datasets/datasets-public.cy.js | 2 -- cypress/e2e/datasets/datasets-publish.cy.js | 2 -- cypress/e2e/datasets/datasets-reduce.cy.js | 2 -- cypress/e2e/datasets/datasets-share.cy.js | 2 -- cypress/e2e/other/elastic-search.cy.js | 2 -- cypress/e2e/other/policy-delegate.cy.js | 2 -- cypress/e2e/other/users-login.cy.js | 2 -- .../proposal-logbook.component.ts | 18 +++++++++++------- tsconfig.json | 2 +- 14 files changed, 12 insertions(+), 31 deletions(-) diff --git a/cypress/e2e/datasets/datasets-attachment.cy.js b/cypress/e2e/datasets/datasets-attachment.cy.js index 99b8b6b97..af965415e 100644 --- a/cypress/e2e/datasets/datasets-attachment.cy.js +++ b/cypress/e2e/datasets/datasets-attachment.cy.js @@ -1,4 +1,3 @@ -/// var path = require("path"); describe("Dataset attachments", () => { diff --git a/cypress/e2e/datasets/datasets-datafiles.cy.js b/cypress/e2e/datasets/datasets-datafiles.cy.js index 46c927424..980614a0b 100644 --- a/cypress/e2e/datasets/datasets-datafiles.cy.js +++ b/cypress/e2e/datasets/datasets-datafiles.cy.js @@ -1,5 +1,3 @@ -/// - describe("Dataset datafiles", () => { beforeEach(() => { cy.login(Cypress.env("username"), Cypress.env("password")); diff --git a/cypress/e2e/datasets/datasets-general.cy.js b/cypress/e2e/datasets/datasets-general.cy.js index 1a571f79f..a6a246132 100644 --- a/cypress/e2e/datasets/datasets-general.cy.js +++ b/cypress/e2e/datasets/datasets-general.cy.js @@ -1,5 +1,3 @@ -/// - describe("Datasets general", () => { beforeEach(() => { cy.login(Cypress.env("username"), Cypress.env("password")); diff --git a/cypress/e2e/datasets/datasets-keyword.cy.js b/cypress/e2e/datasets/datasets-keyword.cy.js index 8e96e707c..af633d877 100644 --- a/cypress/e2e/datasets/datasets-keyword.cy.js +++ b/cypress/e2e/datasets/datasets-keyword.cy.js @@ -1,5 +1,3 @@ -/// - describe("Datasets", () => { beforeEach(() => { cy.login(Cypress.env("username"), Cypress.env("password")); diff --git a/cypress/e2e/datasets/datasets-metadata.cy.js b/cypress/e2e/datasets/datasets-metadata.cy.js index 3f61c3c07..0c476fd9d 100644 --- a/cypress/e2e/datasets/datasets-metadata.cy.js +++ b/cypress/e2e/datasets/datasets-metadata.cy.js @@ -1,5 +1,3 @@ -/// - describe("Datasets", () => { const metadataName = "some name"; const metadataValue = "some value"; diff --git a/cypress/e2e/datasets/datasets-public.cy.js b/cypress/e2e/datasets/datasets-public.cy.js index ba8fbc13a..e1b747e83 100644 --- a/cypress/e2e/datasets/datasets-public.cy.js +++ b/cypress/e2e/datasets/datasets-public.cy.js @@ -1,5 +1,3 @@ -/// - describe("Datasets", () => { beforeEach(() => { cy.login(Cypress.env("username"), Cypress.env("password")); diff --git a/cypress/e2e/datasets/datasets-publish.cy.js b/cypress/e2e/datasets/datasets-publish.cy.js index 39ca01dd6..8921ecdae 100644 --- a/cypress/e2e/datasets/datasets-publish.cy.js +++ b/cypress/e2e/datasets/datasets-publish.cy.js @@ -1,5 +1,3 @@ -/// - describe("Datasets", () => { beforeEach(() => { cy.login(Cypress.env("username"), Cypress.env("password")); diff --git a/cypress/e2e/datasets/datasets-reduce.cy.js b/cypress/e2e/datasets/datasets-reduce.cy.js index 31259ca05..8b55fa897 100644 --- a/cypress/e2e/datasets/datasets-reduce.cy.js +++ b/cypress/e2e/datasets/datasets-reduce.cy.js @@ -1,5 +1,3 @@ -/// - describe("Datasets", () => { beforeEach(() => { cy.login(Cypress.env("username"), Cypress.env("password")); diff --git a/cypress/e2e/datasets/datasets-share.cy.js b/cypress/e2e/datasets/datasets-share.cy.js index 860db076c..eb16ea908 100644 --- a/cypress/e2e/datasets/datasets-share.cy.js +++ b/cypress/e2e/datasets/datasets-share.cy.js @@ -1,5 +1,3 @@ -/// - describe("Datasets", () => { beforeEach(() => { cy.login(Cypress.env("username"), Cypress.env("password")); diff --git a/cypress/e2e/other/elastic-search.cy.js b/cypress/e2e/other/elastic-search.cy.js index 416f9a03d..a9d89153b 100644 --- a/cypress/e2e/other/elastic-search.cy.js +++ b/cypress/e2e/other/elastic-search.cy.js @@ -1,5 +1,3 @@ -/// - describe("Elastic search", () => { const randomText1 = "$PDfUCt+qX*5Km=ezGQF ELASTIC_SEARCH_vg+Mgga2#vEe=u!dQ!V+ fp$q6tz8y%hyaHzbx2X+ Vz6shS8ejGCQN3h%TEST 6j2&eqYT7GCR+CpqqD5n"; diff --git a/cypress/e2e/other/policy-delegate.cy.js b/cypress/e2e/other/policy-delegate.cy.js index fd5fd4e98..5d62b4859 100644 --- a/cypress/e2e/other/policy-delegate.cy.js +++ b/cypress/e2e/other/policy-delegate.cy.js @@ -1,5 +1,3 @@ -/// - describe("Policies", () => { beforeEach(() => { cy.login(Cypress.env("username"), Cypress.env("password")); diff --git a/cypress/e2e/other/users-login.cy.js b/cypress/e2e/other/users-login.cy.js index 28e4de680..edaa2c59f 100644 --- a/cypress/e2e/other/users-login.cy.js +++ b/cypress/e2e/other/users-login.cy.js @@ -1,5 +1,3 @@ -/// - describe("Users Login", () => { const username = Cypress.env("username"); const password = Cypress.env("password"); diff --git a/src/app/proposals/proposal-logbook/proposal-logbook.component.ts b/src/app/proposals/proposal-logbook/proposal-logbook.component.ts index 4b495dd28..9133cb58b 100644 --- a/src/app/proposals/proposal-logbook/proposal-logbook.component.ts +++ b/src/app/proposals/proposal-logbook/proposal-logbook.component.ts @@ -8,7 +8,7 @@ import { } from "@angular/core"; import { Store } from "@ngrx/store"; import { Logbook } from "shared/sdk"; -import { Subscription } from "rxjs"; +import { Observable, Subscription, take } from "rxjs"; import { selectCurrentLogbook } from "state-management/selectors/logbooks.selectors"; import { fetchLogbookAction, @@ -41,10 +41,12 @@ export interface LogbookData { export class ProposalLogbookComponent implements OnInit, OnDestroy, AfterViewChecked { + logbook$: Observable = + this.store.select(selectCurrentLogbook); appConfig = this.appConfigService.getConfig(); subscriptions: Subscription[] = []; - @Input() logbook: LogbookData; + @Input() logbook: LogbookData | null = null; // Still accepting input from parent if provided constructor( public appConfigService: AppConfigService, @@ -86,11 +88,13 @@ export class ProposalLogbookComponent } ngOnInit() { - this.subscriptions.push( - this.store.select(selectCurrentLogbook).subscribe((logbook) => { - this.store.dispatch(fetchLogbookAction({ name: logbook.name })); - }), - ); + if (!this.logbook) { + this.logbook$.pipe(take(1)).subscribe((logbook) => { + if (logbook && logbook.name) { + this.store.dispatch(fetchLogbookAction({ name: logbook.name })); + } + }); + } } ngAfterViewChecked() { diff --git a/tsconfig.json b/tsconfig.json index a3245c745..35821dfd8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -29,5 +29,5 @@ "strictInputAccessModifiers": true, "strictTemplates": true }, - "exclude": ["cypress/**/*.ts", "cypress.config.ts"] + "exclude": ["cypress/**/*.js", "cypress.config.ts"] }