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

SignedIn Wrapper does not refresh on SignOutButton click #37

Open
Hobbitive opened this issue Dec 21, 2023 · 1 comment
Open

SignedIn Wrapper does not refresh on SignOutButton click #37

Hobbitive opened this issue Dec 21, 2023 · 1 comment

Comments

@Hobbitive
Copy link

Hobbitive commented Dec 21, 2023

Step to Reproduce:

  1. Log in to app
  2. Click on SignOutButton
  3. All of elements putted into SignedIn wrapper still appear on the page till manual refresh on page

I am not sure if this is my implementation or just a bug
If its not a bug i would appreciate some help

<ClerkLoaded> <SignedOut> <li class="px-4 first:py-0 last:py-0"> <a href={Paths.signIn} on:click={handleNavStatus} > Sign in </a> </li> </SignedOut> <SignedIn > <li class="px-4 first:py-0 last:py-0"> <SignOutButton /> </li> </SignedIn> </ClerkLoaded>
this code is from component that is being rendered in +layout.svelte

I've tried doing onclicks with goto, location.reload, nothing seems to help with it
The only possible solution is to use <UserButton /> but it doesnt suit my needs

@Hobbitive
Copy link
Author

Hobbitive commented Dec 29, 2023

If anyone will run accros this issue:

<SignOutButton signOutCallback={handleSignOut}> Sign Out </SignOutButton>

first you add callback to your SignOutButton and in the callback you call goto method to some non existing route for example '/sign-out'
and then in the hooks.server.ts file you add:

const handleSignOut: Handle = async ({ event, resolve }) => { if (event.url.pathname.startsWith('/sign-out')) { return new Response('Redirect', {status: 303, headers: { Location: '/' }}); } return resolve(event); }
and add it to your handle
resolved my issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant