Skip to content

Commit

Permalink
fix(proposal_logbook): inifinite logbook fech loop after RxJS upgrade… (
Browse files Browse the repository at this point in the history
#1625)

* fix(proposal_logbook): inifinite logbook fech loop after RxJS upgrade to v7.4.0

* Exclude cy.js from typescript compiler
  • Loading branch information
Junjiequan authored Nov 1, 2024
1 parent 2ae03e8 commit dbc0c31
Show file tree
Hide file tree
Showing 14 changed files with 12 additions and 31 deletions.
1 change: 0 additions & 1 deletion cypress/e2e/datasets/datasets-attachment.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/// <reference types="cypress" />
var path = require("path");

describe("Dataset attachments", () => {
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/datasets/datasets-datafiles.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/// <reference types="cypress" />

describe("Dataset datafiles", () => {
beforeEach(() => {
cy.login(Cypress.env("username"), Cypress.env("password"));
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/datasets/datasets-general.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/// <reference types="cypress" />

describe("Datasets general", () => {
beforeEach(() => {
cy.login(Cypress.env("username"), Cypress.env("password"));
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/datasets/datasets-keyword.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/// <reference types="cypress" />

describe("Datasets", () => {
beforeEach(() => {
cy.login(Cypress.env("username"), Cypress.env("password"));
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/datasets/datasets-metadata.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/// <reference types="cypress" />

describe("Datasets", () => {
const metadataName = "some name";
const metadataValue = "some value";
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/datasets/datasets-public.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/// <reference types="cypress" />

describe("Datasets", () => {
beforeEach(() => {
cy.login(Cypress.env("username"), Cypress.env("password"));
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/datasets/datasets-publish.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/// <reference types="cypress" />

describe("Datasets", () => {
beforeEach(() => {
cy.login(Cypress.env("username"), Cypress.env("password"));
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/datasets/datasets-reduce.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/// <reference types="cypress" />

describe("Datasets", () => {
beforeEach(() => {
cy.login(Cypress.env("username"), Cypress.env("password"));
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/datasets/datasets-share.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/// <reference types="cypress" />

describe("Datasets", () => {
beforeEach(() => {
cy.login(Cypress.env("username"), Cypress.env("password"));
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/other/elastic-search.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/// <reference types="cypress" />

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";
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/other/policy-delegate.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/// <reference types="cypress" />

describe("Policies", () => {
beforeEach(() => {
cy.login(Cypress.env("username"), Cypress.env("password"));
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/other/users-login.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/// <reference types="cypress" />

describe("Users Login", () => {
const username = Cypress.env("username");
const password = Cypress.env("password");
Expand Down
18 changes: 11 additions & 7 deletions src/app/proposals/proposal-logbook/proposal-logbook.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -41,10 +41,12 @@ export interface LogbookData {
export class ProposalLogbookComponent
implements OnInit, OnDestroy, AfterViewChecked
{
logbook$: Observable<Logbook | null> =
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,
Expand Down Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
"strictInputAccessModifiers": true,
"strictTemplates": true
},
"exclude": ["cypress/**/*.ts", "cypress.config.ts"]
"exclude": ["cypress/**/*.js", "cypress.config.ts"]
}

0 comments on commit dbc0c31

Please sign in to comment.