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

correct the unmount lifecyle for amplify-authenticator #8227

Merged
merged 1 commit into from
May 5, 2021

Conversation

hkjpotato
Copy link
Contributor

@hkjpotato hkjpotato commented May 5, 2021

Description of changes

Fix the memory leak issue by using the correct lifecycle method to remove event listener when component is unmounted from DOM.

It seems there is no such lifecycle hook called componentWillUnload. Based on the stencil doc https://stenciljs.com/docs/component-lifecycle#disconnectedcallback, it should be disconnectedCallback.

Issue #, if available

Fixes #6840

Description of how you validated changes

  • run it locally to see the lifecycle is called and handleExternalAuthEvent is being removed from Hub, and thus fix the memory leak issue.

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov-commenter
Copy link

Codecov Report

Merging #8227 (5a7b0cd) into main (dedd564) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #8227   +/-   ##
=======================================
  Coverage   77.67%   77.67%           
=======================================
  Files         236      236           
  Lines       16503    16503           
  Branches     3535     3535           
=======================================
  Hits        12818    12818           
  Misses       3574     3574           
  Partials      111      111           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dedd564...5a7b0cd. Read the comment docs.

Copy link
Contributor

@ericclemmons ericclemmons left a comment

Choose a reason for hiding this comment

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

Oh my gosh, I can't believe this was missed! Thanks for the fix @hkjpotato !

@github-actions
Copy link

github-actions bot commented May 6, 2022

This pull request has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 2022
@jimblanc jimblanc deleted the 6840-fix-authenticator-memory-leak branch November 23, 2022 15:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AmplifyAuthenticator memory leak
3 participants