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

In nextjs/app-beta, the UserButton doesn't seem to work with Suspense? #1142

Open
kleemeo opened this issue May 3, 2023 · 11 comments
Open
Labels
prioritized This issue has been triaged and the team is working on it

Comments

@kleemeo
Copy link

kleemeo commented May 3, 2023

Trying to use the UserButton component in a next 13 server component. I understand there's some time needed to fetch the data from the user via Clerk's api and retrieve the image.

I was wondering why this component/pattern doesn't adhere to the <Suspense /> loading pattern. (Loading UI doesn't show before the component/image is ready)

I've attached a gif of what it's kind of doing, and it does the same even when wrapped with:

  <Suspense fallback={<p>loading...</p>}>
      <UserButton />
  </Suspense>

delay

Am I doing something wrong here or is the implementation of UserButton just doesn't really allow the effects of Suspense as it loads? Sorry if I'm missing something here. Still new to app-router and the clerk app-beta.

Thanks!

@lhennerley
Copy link

I am also seeing this behaviour, did you find a solution or does anyone else know if there is one?

@kleemeo
Copy link
Author

kleemeo commented May 19, 2023

@lhennerley unfortunately not really, please let me know if you or anyone else have figured out the reason for this or a workaround?

I am sure it's something to do with an imported client component not being able to be captured by the Suspense boundaries. Or the fetching of the client component is not registered as a fetch

@clerk-cookie
Copy link
Collaborator

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@clerk-cookie
Copy link
Collaborator

This issue was closed because it has been stalled for 10 days with no activity.

@clerk-cookie clerk-cookie closed this as not planned Won't fix, can't repro, duplicate, stale Jun 28, 2023
@dimkl dimkl reopened this Jun 29, 2023
@mkgo
Copy link

mkgo commented Jul 5, 2023

I am seeing this issue of reloading/ flickering, during navigation also (NextJs 13 AppRouter)

@Apestein
Copy link

I am seeing this issue of reloading/ flickering, during navigation also (NextJs 13 AppRouter)

yeah no way to make it work with suspense, but I just stop the layout shift by putting it in a div and setting the width and height

@clerk-cookie
Copy link
Collaborator

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@jescalan
Copy link
Contributor

Small update - we are working on a resolution for this one. So sorry for the delays!

@jescalan jescalan added prioritized This issue has been triaged and the team is working on it and removed Stale labels Aug 25, 2023
@xNOVA2
Copy link

xNOVA2 commented Oct 7, 2023

im having an issue with the userButton gives hydration error in next 13 and this userButton causing it

@jescalan
Copy link
Contributor

@xNOVA2 The best way to get this addressed would be to open a new issue and provide a minimal reproduction 🙏

@yureribeiro
Copy link

For me, it works well :

import Loading from "@/app/loading";
import { ClerkLoading, SignedIn, SignedOut, UserButton } from "@clerk/nextjs";

export default async function User() {
  return (
    <>
      <ClerkLoading>
        <Loading />
      </ClerkLoading>
      <SignedOut>
        <Link href="/education/sign-in" className={styles.linkSignin}>Entrar</Link>
      </SignedOut>
      <SignedIn>
        <UserButton afterSignOutUrl="/education" />
      </SignedIn>
    </>
  )
}

use ClerkLoading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prioritized This issue has been triaged and the team is working on it
Projects
None yet
Development

No branches or pull requests

9 participants