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

[React][aws-amplify-react]: Authenticator component does pass pass the 'signOut' event to child components #2419

Closed
lambda0xff opened this issue Dec 26, 2018 · 7 comments
Assignees
Labels
feature-request Request a new feature React React related issues

Comments

@lambda0xff
Copy link

lambda0xff commented Dec 26, 2018

Describe the bug
When wrapping components inside a custom <Authenticator>, auth events are correctly propagated to child components through props, except for 'signOut'

To Reproduce
Steps to reproduce the behavior:

const AlwaysOn = (props: any) => {
  console.log('Always on ', props.authState)
  return (
    <div>
      <div>I am always here to show current auth state: {props.authState}</div>
    </div>
  )
}

ReactDOM.render(
  <Authenticator hideDefault={true}>
    <AlwaysOn/>
    <SignUp />
    <SignIn />
    <App />
  </Authenticator>,
document.getElementById('root')

The AlwaysOn component does not correctly display the 'signOut' event

Expected behavior
A clear and concise description of what you expected to happen.
'signOut' event should be passed to child components

@haverchuck haverchuck self-assigned this Dec 26, 2018
@haverchuck haverchuck added bug Something isn't working React React related issues labels Dec 26, 2018
@haverchuck
Copy link
Member

haverchuck commented Dec 26, 2018

@lambda0xff - Are you saying that the child components for should all receive the event as props? I hesitate to do this because it could introduce unexpected behavior for existing apps using this package. Have you tried having the child components listening for the Hub signout event?

@haverchuck haverchuck added pending-close-response-required and removed bug Something isn't working labels Dec 26, 2018
@lambda0xff
Copy link
Author

@haverchuck hi, IMHO if <Authenticator> is going to pass auth events to its child components, I do not see the argument for not passing all auth events because doing so may result in UI components being out of sync with the underlying auth state, for instance in cases where you need to implement side effects for the signout event.

With regards the Hub event bus, the answer is yes: I've tried it and it works as expected.

@haverchuck
Copy link
Member

Hi @lambda0xff - I see your point.

@stale
Copy link

stale bot commented Jun 15, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@sammartinez sammartinez added feature-request Request a new feature and removed enhancement labels Jun 17, 2019
@sammartinez
Copy link
Contributor

@lambda0xff Is this still a valid use case for you? Seems like Hub would give you this and I do see that you called out it works as expected. Please let us know.

@lambda0xff
Copy link
Author

👍

@github-actions
Copy link

This issue 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 Jun 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request a new feature React React related issues
Projects
None yet
Development

No branches or pull requests

3 participants