-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Bugfix FXIOS-10756 App hangs while opening Tab Tray when there are many tabs open #23474
Changes from 4 commits
619de16
c84b9c7
c46fc92
4752f98
8d6d058
c3ee9e5
ec62f29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -291,15 +291,19 @@ class TabTrayViewController: UIViewController, | |
} | ||
|
||
func newState(state: TabTrayState) { | ||
tabTrayState = state | ||
updateTabCountImage(count: state.normalTabsCount) | ||
defer { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to defer the state? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes true we can avoid it. I added it in case in future we want to end the newState method on some if branch, so we don't forget to apply the state, since with this implementation it must be set as last method operation. if state.shouldDismiss {
delegate.didFinish()
// having defer would be nice here so we don't forget applying the state
return
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so, I'm confused here. We're not doing a check if the states are the same or not? what does defer get us vs setting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setting the state as first thing invalidates the checks because then |
||
tabTrayState = state | ||
} | ||
if state.normalTabsCount != tabTrayState.normalTabsCount { | ||
updateTabCountImage(count: state.normalTabsCount) | ||
} | ||
segmentedControl.selectedSegmentIndex = state.selectedPanel.rawValue | ||
|
||
if tabTrayState.shouldDismiss { | ||
if state.shouldDismiss { | ||
delegate?.didFinish() | ||
} | ||
|
||
if tabTrayState.showCloseConfirmation { | ||
if state.showCloseConfirmation { | ||
showCloseAllConfirmation() | ||
} | ||
|
||
|
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.
would this be cleaner if it was a guard? so,
guard tabsState != state else { return }
and do the stuff only then? Or does theshouldShowEmptyView
need to get called every time?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.
Yes i agree i'd be much more cleaner. The thing also for the other states i don't know if comparing the state and applying changes for different state could cause any side effects.
I believe it should be safe to do the comparison at the top since the state should be
Equatable
what do you think ?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.
I mean, if we're comparing at the top of
newState
we should be fine, I think, because it's only doing this particular state. And yeah, everything should beEquatable
state wise, so we should be safe.But maybe I didn't understand the question. What do you mean by "also for the other states i don't know if comparing the state and applying changes for different state could cause any side effects"
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.
Sorry Rou i wasn't clear, i was referring to the other comment you wrote. So i'll go also for the
TabTrayViewController.newState
to have top comparison for the states