-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update clear account behavior, ensure agent is set #1881
Conversation
@@ -178,6 +178,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) { | |||
}), | |||
) | |||
|
|||
setState(s => ({...s, agent})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set agent after login, was missing this
/** | ||
* Clears the `currentAccount` from session. Typically used to drop the user | ||
* back to the sign-in page. | ||
*/ | ||
const clearCurrentAccount = React.useCallback(() => { | ||
setStateAndPersist(s => ({ | ||
...s, | ||
agent: PUBLIC_BSKY_AGENT, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a soft log out. The user was authed and wanted to sign in with a different account.
clearCurrentAccount() | ||
} | ||
}) | ||
}, [state, logout, initSession]) | ||
}, [state, clearCurrentAccount, initSession]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This happens in response to a broadcast channel update. A user could simply be adding a new account, in which case we don't want to nuke their tokens.
If a user does logout, this still still be called, and the other tab will have already nuked their tokens, so same difference.
No description provided.