The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: tidy up
phamhieufd9efe59d202
diff --git a/studio/pages/_app.tsx b/studio/pages/_app.tsxindex e68eccec8b9..9b73864c7b5 100644--- a/studio/pages/_app.tsx+++ b/studio/pages/_app.tsx@@ -91,38 +91,33 @@ const GotrueWrapper: FC = ({ children }) => {let timer: anyconst currentSession = auth.session()+ function tokenRefreshed() {+ setLoading(false)+ // clean subscription+ if (subscription) subscription.unsubscribe()+ // clean timer+ if (timer) clearTimeout(timer)+ }+if (currentSession != undefined && currentSession != null) {// if there is an active session, go aheadsetLoading(false)} else {// else wait for TOKEN_REFRESHED event before continueconst response = auth.onAuthStateChange((_event, session) => {- if (loading && _event == 'TOKEN_REFRESHED') {- setLoading(false)- // clean timer if available- if (timer) {- clearTimeout(timer)- }+ if (loading && _event === 'TOKEN_REFRESHED') {+ tokenRefreshed()}})subscription = response.data ?? null// we need a timeout here, in case token refresh fails- timer = setTimeout(() => {- // check tokenData again, cos it will be cleared when token refresh fails- if (!doesTokenDataExist()) {- setLoading(false)- }- }, 5 * 1000)+ timer = setTimeout(() => setLoading(false), 5 * 1000)}return () => {- if (subscription) {- subscription.unsubscribe()- }- if (timer) {- clearTimeout(timer)- }+ if (subscription) subscription.unsubscribe()+ if (timer) clearTimeout(timer)}}, [])