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

[Session] Extract selectAccount out #3812

Merged
merged 1 commit into from
May 2, 2024
Merged

[Session] Extract selectAccount out #3812

merged 1 commit into from
May 2, 2024

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented May 2, 2024

This is similar to #3811 in spirit and is based on the same insight. selectAccount has nothing to do with session management per se, it's just a wrapper around initSession that tracks the progress of that call. It makes sense to make such state tracking local to where the action was triggered in the UI code. So I'm moving that state back into components.

I moved the isSwitchingAccounts state variable out of the Session API and into the calling components which now call initSession directly. For AccountList, I've plumbed it down from the component that owns the switch press handler.

Test Plan

Use the account switcher, both the popover and the settings one. It feels a bit janky but I replicated the existing logic. This should make it a bit easier to change the UI logic if we'd like to later because it's all local state now.

Copy link

render bot commented May 2, 2024

Copy link

github-actions bot commented May 2, 2024

Old size New size Diff
6.85 MB 6.85 MB -107 B (-0.00%)

@gaearon gaearon force-pushed the sessiondetour-2 branch from 807a0d9 to cb8263c Compare May 2, 2024 04:51
@haileyok
Copy link
Contributor

haileyok commented May 2, 2024

Small thing when selecting an account that I noticed. My selection is highlighted as long as I am still pressing in, but as soon as I release the highlight moves down to "Other Account"

RocketSim_Recording_iPhone_15_Pro_6.1_2024-05-02_07.55.24.mp4

@gaearon gaearon force-pushed the sessiondetour-2 branch from cb8263c to aa1238f Compare May 2, 2024 17:18
@gaearon gaearon merged commit 1a07e23 into main May 2, 2024
6 checks passed
@gaearon gaearon deleted the sessiondetour-2 branch May 2, 2024 17:25
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