Repository navigation
fix: show signed-in github state when the username is missing - #23
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 bothsignedInand a non-emptylogin, so an empty login fell through to the signed-out label. Leaving the library unmounts the sidebar; coming back readsgithub_statusagain, so the wrong label stayed.The sidebar now uses the same rule as the dialog:
github.statusOn(GitHub · @{login})github.signedInUnknowngithub.statusOffLogin persistence was checked separately. A successful
/userlookup is written togithub.json, andgithub_statusstill returns that login after the device-flow session ends. If/userfails 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
How it was tested
bun web/src/utils/githubStatus.test.cjs— an empty, missing, or null login withsignedIn: trueselectsgithub.signedInUnknown; a login still selectsgithub.statusOn; signed out staysgithub.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 .andcargo 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