From fcce5a02870c1218c1404918b9e024fb80e1b8ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Moreau?= Date: Thu, 1 Jun 2023 14:30:51 +0200 Subject: [PATCH] Fix Supabase breaking change on PASSWORD_RECOVERY (#73) --- app/routes/reset-password.tsx | 4 +++- package.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/routes/reset-password.tsx b/app/routes/reset-password.tsx index 07ad659..6f1fff4 100644 --- a/app/routes/reset-password.tsx +++ b/app/routes/reset-password.tsx @@ -110,7 +110,9 @@ export default function ResetPassword() { const { data: { subscription }, } = supabase.auth.onAuthStateChange((event, supabaseSession) => { - if (event === "SIGNED_IN") { + // In local development, we doesn't see "PASSWORD_RECOVERY" event because: + // Effect run twice and break listener chain + if (event === "PASSWORD_RECOVERY" || event === "SIGNED_IN") { const refreshToken = supabaseSession?.refresh_token; if (!refreshToken) return; diff --git a/package.json b/package.json index a1a29c7..b7d77a3 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "@remix-run/node": "*", "@remix-run/react": "*", "@remix-run/serve": "*", - "@supabase/supabase-js": "^2.8.0", + "@supabase/supabase-js": "^2.24.0", "cookie": "^0.5.0", "i18next": "^21.9.1", "i18next-browser-languagedetector": "^6.1.5",