Skip to content

Commit

Permalink
🪟 🐛 Fix duplicate createUser calls on signup (#21454)
Browse files Browse the repository at this point in the history
* revert useEffect causing multiple user creations
  • Loading branch information
josephkmh authored Jan 16, 2023
1 parent c538977 commit 1757a6e
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions airbyte-webapp/src/packages/cloud/services/auth/AuthService.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { User as FirebaseUser } from "firebase/auth";
import React, { useCallback, useContext, useEffect, useMemo, useRef } from "react";
import React, { useCallback, useContext, useMemo, useRef } from "react";
import { useQueryClient } from "react-query";
import { useEffectOnce } from "react-use";
import { Observable, Subject } from "rxjs";
Expand Down Expand Up @@ -160,23 +160,6 @@ export const AuthenticationProvider: React.FC<React.PropsWithChildren<unknown>>
});
});

useEffect(() => {
const onFocus = async () => {
return auth.onAuthStateChanged(async (currentUser) => {
if (!currentUser) {
loggedOut();
} else {
await onAfterAuth(currentUser);
}
});
};

window.addEventListener("focus", onFocus);
return () => {
window.removeEventListener("focus", onFocus);
};
}, [auth, loggedOut, onAfterAuth]);

const queryClient = useQueryClient();

const ctx: AuthContextApi = useMemo(
Expand Down

0 comments on commit 1757a6e

Please sign in to comment.