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

FR: Add support for Angular Change detection and "OnPush" mode #4899

Open
4 tasks done
QuentinFchx opened this issue Jan 10, 2024 · 2 comments · May be fixed by #4997
Open
4 tasks done

FR: Add support for Angular Change detection and "OnPush" mode #4899

QuentinFchx opened this issue Jan 10, 2024 · 2 comments · May be fixed by #4997
Assignees
Labels
Angular An issue or a feature-request for Angular platform Authenticator An issue or a feature-request for an Authenticator UI Component feature-request Request a new feature

Comments

@QuentinFchx
Copy link

QuentinFchx commented Jan 10, 2024

Before creating a new issue, please confirm:

On which framework/platform are you having an issue?

Angular

Which UI component?

Authenticator

How is your app built?

angular cli (v15) / Node v18.15.0

What browsers are you seeing the problem on?

Firefox, Safari

Which region are you seeing the problem in?

eu-west-1

Please describe your bug.

When using the amplify-authenticator component inside a component with ChangeDetectionStrategy.OnPush, nothing is rendered.

What's the expected behaviour?

The amplify-authenticator component should take care of change detection on its own.

Help us reproduce the bug!

I've setup a sample repository : https://github.com/QuentinFchx/amplify-ui-change-detection

When you serve the project, you should see a blank page : the amplify-authenticator is not rendered.

As a workaround, you can uncomment the following lines at https://github.com/QuentinFchx/amplify-ui-change-detection/blob/main/src/app/app.component.ts#L24

this.unsubscribe = this.authenticator.subscribe(() => {
    this.cdRef.detectChanges();
}).unsubscribe;

AFAIK, the issue seems to come from https://github.com/aws-amplify/amplify-ui/blob/main/packages/angular/projects/ui-angular/src/lib/components/authenticator/components/authenticator/authenticator.component.ts#L89.
I'm not sure what is the purpose of the hubSubject, but the callback is never called, thus :

  • the detectChanges in the callback is never called
  • isHandlingHubEvent is never set to true, thus the detectChanges of the authenticator subscription (a few lines below) is never called

Code Snippet

No response

Console log output

No response

Additional information and screenshots

No response

@github-actions github-actions bot added the pending-triage Issue is pending triage label Jan 10, 2024
@ioanabrooks ioanabrooks added bug Something isn't working Angular An issue or a feature-request for Angular platform Authenticator An issue or a feature-request for an Authenticator UI Component and removed pending-triage Issue is pending triage labels Jan 11, 2024
@reesscot
Copy link
Contributor

reesscot commented Jan 12, 2024

@QuentinFchx Thank you for reporting this issue, we are looking into it.

@esauerbo esauerbo added feature-request Request a new feature and removed bug Something isn't working labels Jan 19, 2024
@esauerbo
Copy link
Contributor

Hi @QuentinFchx, I'm changing this to a feature request because our Authenticator component currently isn't designed to support the OnPush change detection strategy. That being said I think this makes sense to implement, and we will try to work this into our roadmap.

I'll also add a note of this to our docs site to avoid future confusion.

@calebpollman calebpollman changed the title Change detection issues with angular's authenticator component and "OnPush" mode FR: Add support for Angular Change detection and "OnPush" mode Jan 23, 2024
@esauerbo esauerbo linked a pull request Feb 9, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Angular An issue or a feature-request for Angular platform Authenticator An issue or a feature-request for an Authenticator UI Component feature-request Request a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants