Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: subscription unsubscribe doc (#21067)

Mohammed Yasin Mulla4d5320644447
diff --git a/apps/docs/spec/supabase_js_v2.yml b/apps/docs/spec/supabase_js_v2.yml
index f723cba0333..054cdf418af 100644
--- a/apps/docs/spec/supabase_js_v2.yml
+++ b/apps/docs/spec/supabase_js_v2.yml
@@ -364,7 +364,7 @@ functions:
isSpotlight: true
code: |
```js
- const subscription = supabase.auth.onAuthStateChange((event, session) => {
+ const { data } = supabase.auth.onAuthStateChange((event, session) => {
console.log(event, session)
if (event === 'INITIAL_SESSION') {
@@ -383,7 +383,7 @@ functions:
})
// call unsubscribe to remove the callback
- subscription.unsubscribe()
+ data.subscription.unsubscribe()
```
- id: listen-to-sign-out
name: Listen to sign out