vercel / nextjs-subscription-payments

Clone, deploy, and fully customize a SaaS subscription application with Next.js.
https://subscription-payments.vercel.app/
MIT License
6.08k stars 1.23k forks source link

Supabase Provider Infinite Refresh Loop #198

Closed bytechase closed 1 year ago

bytechase commented 1 year ago

There seems to be a bug caused on when the supabase provider received an "INITIAL_SESSION" event from supabase.auth.onAuthStateChange. This is causing an infinite refresh loop. I also don't see any documentation of the supabase auth events to have an "INITIAL_SESSION"

Solit0123 commented 1 year ago

I was going to use this project but it seems problematic.

Bartel-C8 commented 1 year ago

Could be probably fixed like here? https://github.com/supabase/supabase/pull/13645

https://github.com/vercel/nextjs-subscription-payments/blob/main/app/supabase-provider.tsx#L27

edgarasben commented 1 year ago

Curious, why do we need the client-side Provider component at all with /app directory and RSC? Would it be possible to go without it?

EDIT: Couldn't the supabase-provider.tsx be replaced by middleware that manages session changes?