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

properly close the switch account dialog #3558

Merged
merged 4 commits into from
Apr 22, 2024
Merged

Conversation

haileyok
Copy link
Contributor

@haileyok haileyok commented Apr 15, 2024

Why

As we discovered in #3451, we need to first close the dialog before running the callback. I.e.

control.close(() => {
	setAccount(account)
})

Ideally we should just always remember to do this and would never have a case of it not working, but there are situations where an unmount might occur before we are ever even able to call control.close(). In those cases, we should call the control.close() when the Dialog component unmounts.

Test Plan

On Android, I have tested switching accounts before and after this change. Before, there would be a brief "freeze" before the dialog disappeared. Now, the dialog closes and then the account switches. The back button works now, whereas before it did not. Recording on an iPhone simulator because recording on an android simulator is 👎

Before

RocketSim_Recording_iPhone_15_Pro_6 1_2024-04-15_11 53 39

After

RocketSim_Recording_iPhone_15_Pro_6 1_2024-04-15_11 54 11

Copy link

github-actions bot commented Apr 15, 2024

Old size New size Diff
6.44 MB 6.44 MB -17 B (-0.00%)

Revert "properly check if the ref is null"

This reverts commit 8f563808a5d39389b0bc47a31e73cd147d1e7e8b.

properly check if the ref is null

ensure dialog is closed on unmount
Copy link

render bot commented Apr 22, 2024

@gaearon gaearon merged commit 1a4e05e into main Apr 22, 2024
6 checks passed
@gaearon gaearon deleted the hailey/switch-acc-dialog-fix branch April 22, 2024 21:46
estrattonbailey added a commit that referenced this pull request Apr 23, 2024
* origin/main: (47 commits)
  Add option to remove quoted post in composer (#3670)
  Add border radius to GIF loading state (#3669)
  use mp4 over webm (#3666)
  Release 1.79 (#3661)
  Update Japanese translation (#3656)
  [Statsig] Add test gates and events (#3659)
  Quick fix to ensure disable 2fa dialog adjusts to keyboard (#3658)
  Email auth factor (#3602)
  GIF Viewer (#3605)
  Ungate profile scroll fix (#3655)
  rm country param (#3653)
  [GIFs] Remove consent flow (#3652)
  [GIFs] Replace GIPHY with Tenor (#3651)
  properly close the switch account dialog (#3558)
  [GIFs] Reset scroll on query change (#3642)
  Update French translations (#3644)
  [GIFs] Add error boundary to GIF picker (#3643)
  Revert "Add layout transitions to the composer photo gallery on iOS (#3609)" (#3649)
  Update Finnish translations  (#3630)
  Update Japanese translations (#3632)
  ...
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