diff --git a/components/profile/settings-accounts-tab.tsx b/components/profile/settings-accounts-tab.tsx index 1e73c3a..1dd4b66 100644 --- a/components/profile/settings-accounts-tab.tsx +++ b/components/profile/settings-accounts-tab.tsx @@ -40,17 +40,20 @@ export function SettingsAccountsTab({ authMethods, isLoadingAuthMethods, onRefre const [isLoadingAccounts, setIsLoadingAccounts] = useState(true) const [accountsError, setAccountsError] = useState(null) const [unlinking, setUnlinking] = useState(null) - const [message, setMessage] = useState<{ type: "success" | "error"; text: string } | null>(null) + const [message, setMessage] = useState<{ type: "success" | "error"; text: string } | null>(() => { + // Check for OAuth callback success on initial render + if (typeof window !== "undefined") { + const params = new URLSearchParams(window.location.search) + if (params.has("linked")) { + window.history.replaceState({}, "", window.location.pathname) + return { type: "success", text: "Account linked successfully!" } + } + } + return null + }) useEffect(() => { fetchAccounts() - // Check for OAuth callback success - const params = new URLSearchParams(window.location.search) - if (params.has("linked")) { - setMessage({ type: "success", text: "Account linked successfully!" }) - window.history.replaceState({}, "", window.location.pathname) - } - // eslint-disable-next-line react-hooks/exhaustive-deps }, []) async function fetchAccounts() { diff --git a/components/profile/settings-security-tab.tsx b/components/profile/settings-security-tab.tsx index 8f0d163..f35d8f8 100644 --- a/components/profile/settings-security-tab.tsx +++ b/components/profile/settings-security-tab.tsx @@ -47,7 +47,6 @@ export function SettingsSecurityTab({ authMethods, isLoadingAuthMethods, onRefre useEffect(() => { fetchPasskeys() - // eslint-disable-next-line react-hooks/exhaustive-deps }, []) async function fetchPasskeys() {