Close GitHub popup after login (vibe-kanban) (#930)
* ## 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.
This commit is contained in:
committed by
GitHub
parent
c8e660c7da
commit
c45e40717e
@@ -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);
|
||||
|
||||
@@ -486,13 +486,7 @@ export function GeneralSettings() {
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t('settings.general.github.helper')}
|
||||
</p>
|
||||
<Button
|
||||
onClick={() =>
|
||||
NiceModal.show('github-login').finally(() =>
|
||||
NiceModal.hide('github-login')
|
||||
)
|
||||
}
|
||||
>
|
||||
<Button onClick={() => NiceModal.show('github-login')}>
|
||||
{t('settings.general.github.connectButton')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user