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

fix tab switcher crashes (speculative fix) #3319

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

brindy
Copy link
Contributor

@brindy brindy commented Sep 4, 2024

Task/Issue URL: https://app.asana.com/0/414235014887631/1207531239053735/f
Tech Design URL:
CC:

Description:
Use a batch update to queue changes, hopefully to fix the crash.

Steps to test this PR:

  1. Open and close the tab switcher
  2. Open and close one tab
  3. Open, close and re-order many tabs
  4. Using something to create a slow network (I use ProxyMan's "slow network conditions") load pages and then update the order of tabs in the tab switcher and also close the tab where the request is running

if let index = tabsModel.indexOf(tab: tab), index < collectionView.numberOfItems(inSection: 0) {
collectionView.reconfigureItems(at: [IndexPath(row: index, section: 0)])
}
collectionView.performBatchUpdates({}, completion: { [weak self] completed in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, so in this case we aren't actually making any batch changes, but rather just waiting for the completion? Not sure I totally follow it, but functionally it works great for me locally.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah my thinking is if we're trying to reconfigure while some other batch is in progress then it's safer to wait. tbh it's just a guess so we'll see how it goes for a week before it gets released. Thanks.

Copy link
Contributor

@samsymons samsymons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved based on stress-testing the change in a number of ways locally, works as expected - added one comment about the logic just for my own understanding.

@brindy brindy merged commit eb516cc into main Sep 5, 2024
16 checks passed
@brindy brindy deleted the brindy/tab-batching-to-fix-crash branch September 5, 2024 01:47
samsymons added a commit that referenced this pull request Sep 9, 2024
# By Christopher Brind (4) and others
# Via Alessandro Boron (1) and others
* main: (27 commits)
  Bump C-S-S to 6.14.1 (#3331)
  DuckPlayer Launch Experiment for iOS (#3328)
  defer loading the tab switcher button until view did load (#3326)
  Release 7.136.0-3 (#3324)
  Release PR: Check for the negative attribution case (#3311)
  fix tab switcher crashes (speculative fix) (#3319)
  Onboarding highlights feature flag setup (#3308)
  Release 7.136.0-2 (#3320)
  Attempt to fix dissapearing privacy icon (#3317)
  Fix bookmarks toolbar behaviour with Sync Promo on iOS 15 (#3313)
  Bump BSK with C-S-S to 6.14.0 (#3314)
  ensure no atb or app version sent with pixel (#3315)
  Fix #3298: Add support for Xcode 16 (#3299)
  Fix Keychain Debug view controller segue (#3310)
  Release 7.136.0-1 (#3309)
  Fix an issue that causes the fire dialog to show multiple times for the same website after dismissing it (#3305)
  [DuckPlayer] 28. Open in Youtube -> Youtube App (#3290)
  usage segmentation (#3263)
  Fix wrong URL displayed for auth dialog (#3307)
  iOS Integration of BSK Onboarding (#3282)
  ...

# Conflicts:
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
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