From c45e40717e312ae169519fa369b396ad3462ff00 Mon Sep 17 00:00:00 2001 From: Louis Knight-Webb Date: Fri, 3 Oct 2025 19:23:13 +0100 Subject: [PATCH] Close GitHub popup after login (vibe-kanban) (#930) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ## Fix Implemented Successfully ✅ I've implemented the GitHub popup auto-close fix with two key changes to [`GitHubLoginDialog.tsx`](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/d872-close-github-pop/frontend/src/components/dialogs/auth/GitHubLoginDialog.tsx): 1. **Auto-close effect**: Added a `useEffect` that automatically closes the dialog when the user becomes authenticated 2. **Reduced flicker**: Reordered the SUCCESS polling case to avoid briefly showing the "Sign in again" prompt The popup will now automatically close within ~1 second after successful GitHub authentication, eliminating the confusing "sign in again" prompt. Type checks pass successfully. * ## Fix Implemented Successfully ✅ I've implemented the complete fix for the GitHub popup staying open in the settings page: **Changes Made:** 1. **Updated [`GitHubLoginDialog.tsx`](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/d872-close-github-pop/frontend/src/components/dialogs/auth/GitHubLoginDialog.tsx#L34-L40)**: Added `modal.resolve(true)` before `modal.hide()` in the auto-close effect to properly settle the Promise 2. **Simplified [`GeneralSettings.tsx`](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/d872-close-github-pop/frontend/src/pages/settings/GeneralSettings.tsx#L489-L491)**: Removed the unnecessary `.finally()` chain since the dialog now manages its own lifecycle The popup will now automatically close after successful GitHub authentication from both the onboarding flow and the settings page. Type checks pass successfully. * Cleanup script changes for task attempt d8729f37-551a-4490-a0bd-396032d528ce * ## Self-Contained Fix Implemented Successfully ✅ I've implemented Option 2 - the most predictable approach that makes the dialog self-contained: **Changes Made:** 1. **Removed the auto-close effect** that depended on external state changes 2. **Added direct modal close in the SUCCESS case** of the device flow polling: - After `await reloadSystem()`, immediately call `modal.resolve(true)` and `modal.hide()` - This happens right when we know authentication succeeded **Benefits of this approach:** - **Self-contained**: The dialog manages its own lifecycle without depending on external state - **Predictable**: The flow is linear and obvious: start → poll → success → close - **Readable**: No complex state dependencies or effects to understand - **Reliable**: Eliminates the timing issues with stale `githubTokenInvalid` flags The popup will now automatically close immediately after successful GitHub authentication in both the onboarding and settings flows. Type checks pass successfully. --- .../src/components/dialogs/auth/GitHubLoginDialog.tsx | 4 +++- frontend/src/pages/settings/GeneralSettings.tsx | 8 +------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/dialogs/auth/GitHubLoginDialog.tsx b/frontend/src/components/dialogs/auth/GitHubLoginDialog.tsx index 8c0c9325..13874e81 100644 --- a/frontend/src/components/dialogs/auth/GitHubLoginDialog.tsx +++ b/frontend/src/components/dialogs/auth/GitHubLoginDialog.tsx @@ -57,9 +57,11 @@ const GitHubLoginDialog = NiceModal.create(() => { switch (poll_status) { case DevicePollStatus.SUCCESS: setPolling(false); - setDeviceState(null); setError(null); await reloadSystem(); + modal.resolve(true); + modal.hide(); + setDeviceState(null); break; case DevicePollStatus.AUTHORIZATION_PENDING: timer = setTimeout(poll, deviceState.interval * 1000); diff --git a/frontend/src/pages/settings/GeneralSettings.tsx b/frontend/src/pages/settings/GeneralSettings.tsx index 15f95c0c..a6e02148 100644 --- a/frontend/src/pages/settings/GeneralSettings.tsx +++ b/frontend/src/pages/settings/GeneralSettings.tsx @@ -486,13 +486,7 @@ export function GeneralSettings() {

{t('settings.general.github.helper')}

-