Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
| onClick={() => { | ||
| if (hasConnectError || timedOut) resetConnect(); | ||
| void handleConnectGitHub(); | ||
| }} |
There was a problem hiding this comment.
Calling
resetConnect() immediately before handleConnectGitHub() is redundant. The connect() function in useGithubUserConnect already calls stopPolling() and setError(null) before transitioning to "connecting", so the prior reset call is a superfluous state round-trip. The same pattern is also repeated in GitHubIntegrationSection.tsx.
| onClick={() => { | |
| if (hasConnectError || timedOut) resetConnect(); | |
| void handleConnectGitHub(); | |
| }} | |
| onClick={() => { | |
| void handleConnectGitHub(); | |
| }} |
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/inbox/components/DataSourceSetup.tsx
Line: 193-196
Comment:
Calling `resetConnect()` immediately before `handleConnectGitHub()` is redundant. The `connect()` function in `useGithubUserConnect` already calls `stopPolling()` and `setError(null)` before transitioning to `"connecting"`, so the prior `reset` call is a superfluous state round-trip. The same pattern is also repeated in `GitHubIntegrationSection.tsx`.
```suggestion
onClick={() => {
void handleConnectGitHub();
}}
```
How can I resolve this? If you propose a fix, please make it concise.| onClick={() => { | ||
| if (hasConnectError || timedOut) resetConnect(); | ||
| void handleConnect(); | ||
| }} | ||
| > | ||
| Update in GitHub |
There was a problem hiding this comment.
Same redundant
resetConnect() pattern as in DataSourceSetup.tsx — connect() already handles the cleanup before transitioning to "connecting". Both call sites can simply call handleConnect() directly.
| onClick={() => { | |
| if (hasConnectError || timedOut) resetConnect(); | |
| void handleConnect(); | |
| }} | |
| > | |
| Update in GitHub | |
| onClick={() => { | |
| void handleConnect(); | |
| }} | |
| > | |
| Update in GitHub |
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/settings/components/sections/GitHubIntegrationSection.tsx
Line: 102-107
Comment:
Same redundant `resetConnect()` pattern as in `DataSourceSetup.tsx` — `connect()` already handles the cleanup before transitioning to `"connecting"`. Both call sites can simply call `handleConnect()` directly.
```suggestion
onClick={() => {
void handleConnect();
}}
>
Update in GitHub
```
How can I resolve this? If you propose a fix, please make it concise.| onClick={() => { | ||
| if (hasConnectError || timedOut) resetConnect(); | ||
| void handleConnect(); | ||
| }} | ||
| > | ||
| {hasConnectError || timedOut ? "Try again" : "Connect GitHub"} |
There was a problem hiding this comment.
Same redundant
resetConnect() before connect() — see the other button in this file.
| onClick={() => { | |
| if (hasConnectError || timedOut) resetConnect(); | |
| void handleConnect(); | |
| }} | |
| > | |
| {hasConnectError || timedOut ? "Try again" : "Connect GitHub"} | |
| onClick={() => { | |
| void handleConnect(); | |
| }} | |
| > | |
| {hasConnectError || timedOut ? "Try again" : "Connect GitHub"} |
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/settings/components/sections/GitHubIntegrationSection.tsx
Line: 114-119
Comment:
Same redundant `resetConnect()` before `connect()` — see the other button in this file.
```suggestion
onClick={() => {
void handleConnect();
}}
>
{hasConnectError || timedOut ? "Try again" : "Connect GitHub"}
```
How can I resolve this? If you propose a fix, please make it concise.… git user integration
05a5621 to
e01d637
Compare

Problem
GitHub connection state (connecting, timed-out, error) was duplicated across
DataSourceSetupandGitHubIntegrationSection, each managing their own polling timers, error handling, and toast notifications independently.Changes
Extracted the GitHub OAuth connect flow into a shared
useGithubUserConnecthook that owns the connection state machine (idle,connecting,timed-out,error) and exposesconnect,reset, and adescribeGithubConnectErrorhelper.Both
DataSourceSetupandGitHubIntegrationSectionnow consume this hook instead of managing their own polling refs and state. Error and timeout messages are surfaced inline in the UI rather than via toasts, and the connect button label changes to "Try again" when the flow fails or times out so users can retry without reloading.