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

Weird css loading on Auth UI page reload #230

Open
bearbricknik opened this issue Oct 18, 2023 · 9 comments
Open

Weird css loading on Auth UI page reload #230

bearbricknik opened this issue Oct 18, 2023 · 9 comments
Labels
bug Something isn't working

Comments

@bearbricknik
Copy link

bearbricknik commented Oct 18, 2023

Hi, am wondering why this weird animation without css is happening on the /signin page as its not returning the auth without any css attached on the first page reload.

Video:
https://github.com/supabase/auth-ui/assets/131278641/1e15475d-9de3-4cf9-9dd8-f5e61d512774

page.tsx:

import { getSession } from '@/app/supabase-server';
import AuthUI from './AuthUI';

import { redirect } from 'next/navigation';
import Logo from '@/components/icons/Logo';

export default async function SignIn() {
  const session = await getSession();

  if (session) {
    return redirect('/account');
  }

  return (
    <div className="bg-bkg flex justify-center height-screen-helper">
      <div className="flex flex-col justify-between max-w-lg p-3 m-auto w-80">
        <div className="flex justify-center pb-12">
          <Logo width="64px" height="64px"/>
        </div>
        <AuthUI />
      </div>
    </div>
  );
}

AuthUI.tsx:

'use client';

import { useSupabase } from '@/app/supabase-provider';
import { getURL } from '@/utils/helpers';
import { Auth } from '@supabase/auth-ui-react';
import { ThemeSupa } from '@supabase/auth-ui-shared';
import { useTheme } from 'next-themes'

export default function AuthUI() {
  const { resolvedTheme } = useTheme();
  const { supabase } = useSupabase();
  return (
    <div className="flex flex-col space-y-4">
      <Auth
        supabaseClient={supabase}
        providers={['google', 'apple']}
        redirectTo={`${getURL()}/auth/callback`}
        magicLink={true}
        theme={resolvedTheme === 'dark' ? 'dark' : 'default'}
        appearance={{
          theme: ThemeSupa,
          variables: {
            default: {
              colors: {
                defaultButtonBackground: 'bg-white',
                brand: '#2563eb',
                brandAccent: '#3b82f6',
              }
            }
          }
        }}
      />
    </div>
  );
}

To reproduce it: Basically just install the auth UI and its ThemeSupa and use the code. On every page reload I get this weird loading (not showing css in the first eye blink).

@bearbricknik bearbricknik added the bug Something isn't working label Oct 18, 2023
@dvvolynkin
Copy link

dvvolynkin commented Oct 18, 2023

I have same issue.
changed appearance too

[email protected] [email protected]

@ersinakinci
Copy link

Same here. Using dynamic loading with ssr: false in Next.js as a workaround.

@bearbricknik
Copy link
Author

Same here. Using dynamic loading with ssr: false in Next.js as a workaround.

How exactly you do that? Within the login page? Or within the authUI?

@EpicDevv
Copy link

EpicDevv commented Nov 13, 2023

Same here. Using dynamic loading with ssr: false in Next.js as a workaround.

How exactly you do that? Within the login page? Or within the authUI?

You have to use the dynamic import from next js probably where the component is being used

@nmalchy
Copy link

nmalchy commented Nov 13, 2023

Same sort of issue except I'm using the Svelte example, I tried enabling and disabling SSR mode but same weird effect on page load, and honestly this sort of ruins everything if you want to convey to the user you're on a high-quality site..

EDIT: I actually disabled SSR mode incorrectly initially, after correctly disabling it the weird effect is no longer there, but the problem is I would like SSR mode enabled 😅

@dvvolynkin
Copy link

I've set CSS classes directly and it become stable

@vigneshksaithal
Copy link

#240

@scosman
Copy link

scosman commented Jan 8, 2024

Workaround for SvelteKit: export const ssr = false

@vogdev
Copy link

vogdev commented Apr 25, 2024

Same

Screenshot 2024-04-25 at 21 06 17

"use client"
Screenshot 2024-04-25 at 21 09 34

Screen.Recording.2024-04-25.at.21.02.06.mov

Lucho-git pushed a commit to Lucho-git/SKANstarter that referenced this issue Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants