Skip to content
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

Merged
merged 1 commit into from
Nov 13, 2023

Conversation

estrattonbailey
Copy link
Member

No description provided.

@@ -178,6 +178,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
}),
)

setState(s => ({...s, agent}))
Copy link
Member Author

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

Comment on lines +377 to +384
/**
* 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,
Copy link
Member Author

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.

Comment on lines +434 to +437
clearCurrentAccount()
}
})
}, [state, logout, initSession])
}, [state, clearCurrentAccount, initSession])
Copy link
Member Author

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.

@pfrazee pfrazee merged commit 37a2204 into main Nov 13, 2023
3 of 4 checks passed
@pfrazee pfrazee deleted the eric/app-914-fix-expiring-session-handling branch November 13, 2023 16:23
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