markjaquith / clerk-sveltekit

Clerk adapter for SvelteKit
Other
146 stars 21 forks source link

Redirecting/Refreshing when trying to use <SignUp> and <SignIn> #64

Closed kschniedergers closed 3 months ago

kschniedergers commented 3 months ago

I have a website where I'm using the component on the homepage and I'm having an issue where after submitting an email and password, the component becomes the email verification page for a quick second before the whole page redirects to the clerk hosted sign in page (the whole login flow should just stay on the same page, the homepage). I've tried adding "signInUrl": "/" to client.hooks.ts but that seemingly makes the page refresh so the verification part doesn't show up and it goes back to its default state instead of redirecting. +page.svelte

             <SignedOut>
                <div class=" bg-white border-4 rounded-lg border-black p-8">
                    <Tabs.Root>
                        <Tabs.List class="grid w-full grid-cols-2">
                            <Tabs.Trigger value="signup">Sign Up</Tabs.Trigger>
                            <Tabs.Trigger value="signin">Sign In</Tabs.Trigger>
                        </Tabs.List>
                        <Tabs.Content value="signup">
                            <SignUp
                                fallbackRedirectUrl="/vault"
                                appearance={{
                                    elements: {
                                        footer: { display: 'none' },
                                    },
                                }}
                            />
                        </Tabs.Content>
                        <Tabs.Content value="signin">
                            <SignIn
                                appearance={{
                                    elements: {
                                        footer: { display: 'none' },
                                    },
                                }}
                            />
                        </Tabs.Content>
                    </Tabs.Root>
                </div>
            </SignedOut>

+hooks.client.ts

initializeClerkClient(PUBLIC_CLERK_KEY, {
    afterSignInUrl: '/vault',
    afterSignUpUrl: '/vault',
});
kschniedergers commented 3 months ago

nevermind, still haven't figured it out but it has something to do with the shadcn-svelte Tabs, removing those makes everything work.