-
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
Conversation
…ix Swipe to close tab cell causing a blink when the animation is about to close
Client.app: Coverage: 31.73
Generated by 🚫 Danger Swift against ec62f29 |
This pull request has conflicts when rebasing. Could you fix it @FilippoZazzeroni? 🙏 |
@mergify backport release/v134 |
✅ Backports have been created
|
@@ -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 comment
The 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 comment
The 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 comment
The 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 tabTrayState = state
at the beginning, and then updating, given that we're just basically update off state
here??
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.
Setting the state as first thing invalidates the checks because then tabTrayState
will be always equal to state
. Yes here the only state comparison is done on updateTabCountImage
but yes you are right @adudenamedruby. i didn't implement the guard at the top cause i wasn't sure about any side effects it could cause. But i think that is the best idea
@@ -162,9 +161,11 @@ class TabDisplayPanelViewController: UIViewController, | |||
} | |||
|
|||
func newState(state: TabsPanelState) { | |||
if state != tabsState { |
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 the shouldShowEmptyView
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 be Equatable
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
@@ -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 comment
The 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 tabTrayState = state
at the beginning, and then updating, given that we're just basically update off state
here??
@dataports i've merged main. You can test on new Xcode version if u want |
…ny tabs open (#23474) * Little optimization on tab tray when updating counter image * Optimize TabDisplayPanel newState to avoid unnecessary view reload, Fix Swipe to close tab cell causing a blink when the animation is about to close * Refactor TabDisplayView to pipe collection view scroll after layout * Refactor as per code review * Refactor state to use tabState --------- Co-authored-by: Filippo <[email protected]> (cherry picked from commit 2d5125e)
…ny tabs open (backport #23474) (#23657) * Optimize TabDisplayPanel newState to avoid unnecessary view reload, Fix Swipe to close tab cell causing a blink when the animation is about to close * Refactor TabDisplayView to pipe collection view scroll after layout * Refactor state to use tabState --------- Co-authored-by: Filippo <[email protected]> (cherry picked from commit 2d5125e) Co-authored-by: FilippoZazzeroni <[email protected]>
I'm late, but I just did a quick test and everything looks good 👍 thanks! |
…ny tabs open (backport #23474) (#23657) * Optimize TabDisplayPanel newState to avoid unnecessary view reload, Fix Swipe to close tab cell causing a blink when the animation is about to close * Refactor TabDisplayView to pipe collection view scroll after layout * Refactor state to use tabState --------- Co-authored-by: Filippo <[email protected]> (cherry picked from commit 2d5125e) Co-authored-by: FilippoZazzeroni <[email protected]>
Ok thanks so much @dataports |
📜 Tickets
Jira ticket
Github issue
💡 Description
Bug fix App hang while opening the tab tray that is mainly caused by the
TabTrayDisplayView.newState
being called many times. OptimizescrollToTab
method to wait for the collection view layout to finish, instead of forcing layout.Bug fix swipe gesture to delete tab flashing back to normal position after the tab was dismissed.
Here is the link of the currently tracked app hangs Spreadsheet
📝 Checklist
You have to check all boxes before merging
@Mergifyio backport release/v120
)