-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
aws-amplify/ui-react - renders component when user is not signed in #5547
Comments
@onlybakam : could you provide us with a sample of your code? |
import Amplify from 'aws-amplify'
import { withAuthenticator } from '@aws-amplify/ui-react'
Amplify.configure(awsconfig)
function App() {
React.useEffect(() => {
console.log('called') // <- logged even if user is not authenticated
}, [])
return (
<div>hi</div>
)
}
export default withAuthenticator(App) |
Investigating a change to this behavior |
The auth state handling is now baked into the |
Hey @jordanranz thanks for all your work on the the amplify components and quick turnaround times on issues/feedback! I was wanting to make a suggestion in holding off on closing issues until any changes are pushed to the main library as opposed to My use case is that I have a few blog posts coming out regarding the auth components, but want to avoid using the |
Any update on the AmplifyAuthenticator version of this? I am seeing this issue, and seems to be a very strange behavior. v2, which I use in different projects does not render the app, but here I have the following: const App = () => (
<AmplifyAuthenticator>
{/* Customize Amplify Auth Components (https://docs.amplify.aws/ui/auth/authenticator/q/framework/react#sign-up) */}
{AuthenticationComponents}
{/* Application */}
<Provider store={store}>
<Router>
<Navigation defaultExpand={true}>
{/* Main content */}
<Routes />
</Navigation>
</Router>
</Provider>
</AmplifyAuthenticator>
);
export default App; Where Could you advise on how to use your fix if it is already in master? or if not, can I follow your merge request when you put it up? thanks |
any update on the Authenticator component part? Still having problem with |
@mtliendo this is good feedback. It auto closes from the hook in the PR but it may be better to hold off on using that. @kmbro and @trungtin, this is a known limitation to the web component default slot. The recommended way to to manage the application mounting would be to use this guide: https://docs.amplify.aws/ui/auth/authenticator/q/framework/react#manage-auth-state-and-conditional-app-rendering |
@jordanranz This worked great for me. Thanks for the linked doc above! |
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 |
Describe the bug
@aws-amplify/ui-react": "^0.2.3
With
user is not signed in but
App
is still "rendered" (though not visible). The useEffect hooks are triggered, indicated that it was rendered. theApp
should not be rendered until a user has signed in.The text was updated successfully, but these errors were encountered: