From e825d07bd837af733fd3511ed790d77ea9ccb684 Mon Sep 17 00:00:00 2001 From: Sergio Padrino Date: Wed, 23 Oct 2024 16:27:38 +0200 Subject: [PATCH 1/3] Bump changelog and version to v3.4.8 --- app/package.json | 2 +- changelog.json | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/package.json b/app/package.json index b05c8bb4552..0e05c36083f 100644 --- a/app/package.json +++ b/app/package.json @@ -3,7 +3,7 @@ "productName": "GitHub Desktop", "bundleID": "com.github.GitHubClient", "companyName": "GitHub, Inc.", - "version": "3.4.7", + "version": "3.4.8", "main": "./main.js", "repository": { "type": "git", diff --git a/changelog.json b/changelog.json index b1b53e05d64..29e33f024b4 100644 --- a/changelog.json +++ b/changelog.json @@ -1,5 +1,8 @@ { "releases": { + "3.4.8": [ + "[Fixed] App no longer crash for first time users going through the welcome flow and attempting to sign in more than once" + ], "3.4.7": [ "[Improved] Support entering GitHub.com as a GitHub Enterprise endpoint - #19342" ], From 863990739b5c1a3c068bdca3d40b63eaf20fd7cf Mon Sep 17 00:00:00 2001 From: Sergio Padrino Date: Wed, 23 Oct 2024 16:23:41 +0200 Subject: [PATCH 2/3] Merge pull request #19442 from desktop/fix-existing-account-crash Fix crash in welcome flow when signing in to an endpoint that has an existing account --- app/src/lib/stores/sign-in-store.ts | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/app/src/lib/stores/sign-in-store.ts b/app/src/lib/stores/sign-in-store.ts index a5253b8874f..193c6b3456c 100644 --- a/app/src/lib/stores/sign-in-store.ts +++ b/app/src/lib/stores/sign-in-store.ts @@ -548,10 +548,13 @@ export class SignInStore extends TypedBaseStore { * This method must only be called when the store is in the authentication * step or an error will be thrown. */ - public authenticateWithBrowser() { + public async authenticateWithBrowser() { const currentState = this.state - if (!currentState || currentState.kind !== SignInStep.Authentication) { + if ( + currentState?.kind !== SignInStep.Authentication && + currentState?.kind !== SignInStep.ExistingAccountWarning + ) { const stepText = currentState ? currentState.kind : 'null' return fatalError( `Sign in step '${stepText}' not compatible with browser authentication` @@ -560,13 +563,26 @@ export class SignInStore extends TypedBaseStore { this.setState({ ...currentState, loading: true }) + if (currentState.kind === SignInStep.ExistingAccountWarning) { + const { existingAccount } = currentState + // Try to avoid emitting an error out of AccountsStore if the account + // is already gone. + if (this.accounts.find(x => x.endpoint === existingAccount.endpoint)) { + await this.accountStore.removeAccount(existingAccount) + } + } + const csrfToken = uuid() new Promise((resolve, reject) => { - const { endpoint } = currentState + const { endpoint, resultCallback } = currentState log.info('[SignInStore] initializing OAuth flow') this.setState({ - ...currentState, + kind: SignInStep.Authentication, + endpoint, + resultCallback, + error: null, + loading: true, oauthState: { state: csrfToken, endpoint, From e3aa0782c40138d43d289b263f146e3e7df33023 Mon Sep 17 00:00:00 2001 From: Sergio Padrino Date: Wed, 23 Oct 2024 16:55:35 +0200 Subject: [PATCH 3/3] Add missing props --- app/src/lib/stores/sign-in-store.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/lib/stores/sign-in-store.ts b/app/src/lib/stores/sign-in-store.ts index 193c6b3456c..c6e24a1ff92 100644 --- a/app/src/lib/stores/sign-in-store.ts +++ b/app/src/lib/stores/sign-in-store.ts @@ -575,12 +575,15 @@ export class SignInStore extends TypedBaseStore { const csrfToken = uuid() new Promise((resolve, reject) => { - const { endpoint, resultCallback } = currentState + const { endpoint, resultCallback, supportsBasicAuth, forgotPasswordUrl } = + currentState log.info('[SignInStore] initializing OAuth flow') this.setState({ kind: SignInStep.Authentication, endpoint, resultCallback, + supportsBasicAuth, + forgotPasswordUrl, error: null, loading: true, oauthState: {