Compare commits

...

2 Commits

Author SHA1 Message Date
Saoud Rizwan e4f6783140 Create rude-vans-cry.md 2025-04-01 11:46:09 -07:00
Saoud Rizwan 174c098cdf Fix firebase session being inconsistent in popout tabs 2025-04-01 11:43:49 -07:00
5 changed files with 24 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"claude-dev": patch
---
Fix issue with Cline accounts not showing user info in popout tabs
+1
View File
@@ -107,6 +107,7 @@ export class Controller {
async handleSignOut() {
try {
await storeSecret(this.context, "clineApiKey", undefined)
await updateGlobalState(this.context, "userInfo", undefined)
await updateGlobalState(this.context, "apiProvider", "openrouter")
await this.postStateToWebview()
vscode.window.showInformationMessage("Successfully logged out of Cline")
@@ -7,6 +7,7 @@ import ClineLogoWhite from "../../assets/ClineLogoWhite"
import CountUp from "react-countup"
import CreditsHistoryTable from "./CreditsHistoryTable"
import { UsageTransaction, PaymentTransaction } from "../../../../src/shared/ClineAccount"
import { useExtensionState } from "../../context/ExtensionStateContext"
type AccountViewProps = {
onDone: () => void
@@ -29,7 +30,11 @@ const AccountView = ({ onDone }: AccountViewProps) => {
}
export const ClineAccountView = () => {
const { user, handleSignOut } = useFirebaseAuth()
const { user: firebaseUser, handleSignOut } = useFirebaseAuth()
const { userInfo, apiConfiguration } = useExtensionState()
let user = apiConfiguration?.clineApiKey ? firebaseUser || userInfo : undefined
const [balance, setBalance] = useState(0)
const [isLoading, setIsLoading] = useState(true)
const [usageData, setUsageData] = useState<UsageTransaction[]>([])
@@ -1,9 +1,13 @@
import { VSCodeButton } from "@vscode/webview-ui-toolkit/react"
import { useFirebaseAuth } from "../../context/FirebaseAuthContext"
import { vscode } from "../../utils/vscode"
import { useExtensionState } from "../../context/ExtensionStateContext"
export const ClineAccountInfoCard = () => {
const { user, handleSignOut } = useFirebaseAuth()
const { user: firebaseUser, handleSignOut } = useFirebaseAuth()
const { userInfo, apiConfiguration } = useExtensionState()
let user = apiConfiguration?.clineApiKey ? firebaseUser || userInfo : undefined
const handleLogin = () => {
vscode.postMessage({ type: "accountLoginClicked" })
@@ -37,6 +37,13 @@ export const FirebaseAuthProvider: React.FC<{ children: React.ReactNode }> = ({
setUser(user)
setIsInitialized(true)
console.log("onAuthStateChanged user", user)
if (!user) {
// when opening the extension in a new webview (ie if you logged in to sidebar webview but then open a popout tab webview) this effect will trigger without the original webview's session, resulting in us clearing out the user info object.
// we rely on this object to determine if the user is logged in, so we only want to clear it when the user logs out, rather than whenever a webview without a session is opened.
return
}
// Sync auth state with extension
vscode.postMessage({
type: "authStateChanged",