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
fix(aws-amplify-react-native): Update Hub listener for sign out events #5587
Conversation
This pull request fixes 2 alerts when merging b8fed61 into 14f1ef9 - view on LGTM.com fixed alerts:
|
Codecov Report
@@ Coverage Diff @@
## master #5587 +/- ##
=======================================
Coverage 72.91% 72.91%
=======================================
Files 197 197
Lines 11536 11536
Branches 2178 2178
=======================================
Hits 8412 8412
Misses 2971 2971
Partials 153 153 Continue to review full report at Codecov.
|
Can we accompany this with unit tests and/or integration tests? |
Just added a test to the existing PR for React Native Auth integration tests: https://github.com/aws-amplify/amplify-js-samples-staging/pull/76 |
Co-Authored-By: Eric Clemmons <eric@smarterspam.com>
This pull request fixes 2 alerts when merging ea588fe into ebe0b69 - view on LGTM.com fixed alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of nits. Looks good. Agree with Praveen, could we have a unit test added for this here?
There are no existing unit tests for |
Co-Authored-By: Ashika <35131273+ashika01@users.noreply.github.com>
This pull request fixes 2 alerts when merging d437641 into e89ac00 - view on LGTM.com fixed alerts:
|
let nextAuthState; | ||
if (state === 'signedOut') { | ||
state = 'signIn'; | ||
nextAuthState = this._initialAuthState; | ||
} else { | ||
nextAuthState = state; | ||
} | ||
|
||
let nextAuthData = this.state.authData; | ||
if (data !== undefined) { | ||
nextAuthData = data; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know the important bit here is the hub listener for signout and looks good.
We can clean nextAuthData
and nextAuthState
with ternary operator so this is readable and become easier later. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great call 👍 I just updated the PR
This pull request fixes 2 alerts when merging f090258 into 41fb52c - view on LGTM.com fixed alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 🎉 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates @amhinson! Looking good!
This pull request fixes 2 alerts when merging 06b408f into 8f03e22 - view on LGTM.com fixed alerts:
|
Can you able to look this? This case is if the user is already in the app and the admin has disabled the user. So I called Auth.signOut. After this it changing the authState to signIn and then immediately changed to signedIn. So it not properly navigate to login screen. Again reloaded the app will show the SignIn screen. Steps:
Here: I don't want to reload the app in the 6th step Also, can you give any solution for the 3rd point Your reply will be helpful |
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 |
Issue #, if available:
Closes #4057
Description of changes:
Auth.signOut()
directly instead of using the sign out button inGreeting
. TheonHubCapsule
method was refactored based on the web UI components.handleStateChange
to only block setting state ifthis._isMounted === false
instead of the entire method. This also makes some changes to more closely resemble the web UI logic.checkUser
is only called once instead of every time anauth
event occurs. That behavior is also to reflect the web UI.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.