saas-js / saas-ui

The React component library for startups, built with Chakra UI.
https://saas-ui.dev
MIT License
1.3k stars 124 forks source link

Auth component throw error #11

Closed fengkx closed 2 years ago

fengkx commented 2 years ago

I am using Auth component in nextjs. Provider is setting with a supabase client.

<SaasProvider theme={theme} {...createAuthService(supabase)}>
    <AuthProvider>
        <Component {...pageProps} />
    </AuthProvider>
  </SaasProvider>

I use Auth component with a github provider which is support in supabase.

<Auth
    providers={{
      google: {
          name: 'GitHub',
          icon: FaGithub
        }
      }}
      type="password"
 />

this error is thrown

Unhandled Runtime Error
TypeError: Cannot destructure property 'logIn' of 'x(...)' as it is null.

Call Stack
M
node_modules/.pnpm/@saas-ui+auth@0.6.1_ae4b258d679467cd3105b6a0b1e43c4d/node_modules/@saas-ui/auth/dist/index.modern.js (365:0)
renderWithHooks

I can only render component by removing providers props. But once I login with password. TypeError: Cannot read properties of null (reading 'logIn')

Call Stack eval node_modules/.pnpm/@saas-ui+auth@0.6.1_ae4b258d679467cd3105b6a0b1e43c4d/node_modules/@saas-ui/auth/dist/index.modern.js (111:0) eval node_modules/.pnpm/@saas-ui+hooks@0.3.0_react@17.0.2/node_modules/@saas-ui/hooks/dist/index.modern.js (1:261) onSubmit node_modules/.pnpm/@saas-ui+auth@0.6.1_ae4b258d679467cd3105b6a0b1e43c4d/node_modules/@saas-ui/auth/dist/index.modern.js (270:0) eval


this error is thrown
fengkx commented 2 years ago

Look like the supabase service is working in progress?

Pagebakers commented 2 years ago

Thanks for the report @fengkx!

Looks like there's an error in the docs, I'll get this sorted.

It should be:

<AuthProvider {...createAuthService(supabase)}>
Pagebakers commented 2 years ago

Fixed the example here: https://www.saas-ui.dev/docs/auth/auth-provider