Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quoting feature results in a non stable application on certain pages #1265

Merged
merged 5 commits into from
Sep 28, 2022

Conversation

Eisie96
Copy link
Contributor

@Eisie96 Eisie96 commented Sep 8, 2022

PR Type

[ x ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no API changes)
[ ] Build-related changes
[ ] CI-related changes
[ ] Documentation content changes
[ ] Application / infrastructure changes
[ ] Other:

What Is the Current Behavior?

If the 'quoting' feature is enabled, then all pages, where quoting components are rendered (/account, /account/quotes), are not stable. This problem is caused by the automatic refresh of quoting entities with the use of the 'timer' operator in the quotingEntities$ observable pipe.

Issue Number: Closes #1264

What Is the New Behavior?

The quotingEntities$ function has a new automaticRefresh option. When the option is enabled, the timer operator will be executed right after the app is stable.

Does this PR Introduce a Breaking Change?

[ ] Yes
[ x ] No

Other Information

If the automaticRefresh option is enabled, it is necessary to subscribe to the quotingEntities$ observable in the component and to manually trigger the change detection. The reason for that is, that the used ApplicationRef.isStable observable runs outside of the Angular zone. It will not trigger the change detection automatically and not update the template.(https://docs.angular.lat/api/core/ApplicationRef)

Example from documentation:

constructor(appRef: ApplicationRef, cd: ChangeDetectorRef) {
  appRef.isStable.pipe(
    first(stable => stable),
    switchMap(() => interval(1000))
  ).subscribe(counter => {
    this.value = counter;
    cd.detectChanges();
  });
}

AB#79432

@shauke shauke added this to the 3.1 milestone Sep 8, 2022
@SGrueber SGrueber self-requested a review September 9, 2022 06:53
@SGrueber SGrueber added the bug Something isn't working label Sep 9, 2022
@@ -55,3 +55,7 @@ export interface QuoteRequestResponse extends QuoteBaseData<Link | QuoteRequestL
}

export type QuoteData = Link | QuoteResponse | QuoteRequestResponse;

export interface QuoteEntitiesOptions {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Interfaces should only be used to accept data of REST calls. Anyway, I 'd prefer to remove it at all.
If use use an interface only at one place you can define it at this place, otherwise in the model.

@Eisie96 Eisie96 merged commit 8ef8768 into develop Sep 28, 2022
@Eisie96 Eisie96 deleted the bugfix/quoting-stable-application branch September 28, 2022 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quoting feature results in a non stable application on certain pages
3 participants