Skip to content

fix: show signed-in github state when the username is missing - #23

Merged
phaethix merged 1 commit into
mainfrom
cursor/github-sidebar-signed-in-330d
Oct 31, 2026
Merged

phaethix merged 1 commit into
mainfrom
cursor/github-sidebar-signed-in-330d

Conversation

@phaethix

Copy link
Copy Markdown
Owner

Summary

After a successful GitHub Device Flow sign-in, the library sidebar could still show 「GitHub 未登录」 (github.statusOff) even though the access token was saved and the sync dialog showed a signed-in state. The dialog already treats “signed in, no username” as signed in (github.signedInUnknown). The sidebar required both signedIn and a non-empty login, so an empty login fell through to the signed-out label. Leaving the library unmounts the sidebar; coming back reads github_status again, so the wrong label stayed.

The sidebar now uses the same rule as the dialog:

  • signed in with a login → github.statusOn (GitHub · @{login})
  • signed in without a login → github.signedInUnknown
  • otherwise → github.statusOff

Login persistence was checked separately. A successful /user lookup is written to github.json, and github_status still returns that login after the device-flow session ends. If /user fails without invalidating the token (for example HTTP 403), the token stays stored and the session remains signed in with an empty login. That is the state the sidebar was labeling as signed out. Remounting does not drop a login that was actually saved.

Type of change

  • Bug fix
  • New feature
  • Build, CI or tooling
  • Documentation

How it was tested

  • bun web/src/utils/githubStatus.test.cjs — an empty, missing, or null login with signedIn: true selects github.signedInUnknown; a login still selects github.statusOn; signed out stays github.statusOff.
  • cargo test --manifest-path desktop/src-tauri/Cargo.toml --lib — 16 passed, including login read-back after device flow and staying signed in when the login lookup returns 403.
  • bun x prettier --check . and cargo fmt --check.

The Tauri desktop shell was not launched here, so the sidebar was not clicked in the app. The label is a pure function of the status object the sidebar already loads on mount.

Checklist

  • I ran the relevant build or test locally — CI covers formatting and the web build
  • Behaviour changes are reflected in the README or in code comments
Open in Web Open in Cursor 

The library sidebar required both a token and a login, so a saved
session with an empty username showed the signed-out label after
returning home. Treat signedIn alone as signed in, and keep @login
when the name was stored.

Co-authored-by: cosmoli <phaethix@users.noreply.github.com>
@phaethix
phaethix merged commit cf07f43 into main Oct 31, 2026
5 checks passed
@phaethix
phaethix deleted the cursor/github-sidebar-signed-in-330d branch October 31, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants