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

Stats Traffic: Fix a crash on iOS 15 & 16 when expanding rows #22857

Conversation

staskus
Copy link
Contributor

@staskus staskus commented Mar 19, 2024

Fixes #22853

Stats Traffic crashes when expanding table view rows (e.g. Clicks, Authors cards) on iOS 15 and iOS 16. The issue is not reproducible on iOS 17:

UITableView must be updated via the UITableViewDiffableDataSource APIs when acting as the UITableView's dataSource: please do not call mutation APIs directly on UITableView.

The crash is related to recent changes made that introduced diffable data source to Stats Traffic tab (StatsPeriodTableViewController). I updated table view reloads that were triggered by view model but haven't updates table view reloads triggered by trying to expand table view cell rows. It incorrectly calls performBatchUpdates which shouldn't be called for table views that use diffable data souce.

We missed this crash since it doesn't happen on iOS 17.

My changes removed the animation when expanding table view rows. However, this is intentional since the animation both on Stats Traffic and Days/Weeks/Months/Years tabs looks broken.

iOS 16 crash

Crash.iOS.16.mp4

iOS 16 no crash after the fix

No.Crash.After.Fix.mp4

To test:

iOS 15 / iOS 16

  1. Launch Jetpack app on iOS 15 or iOS 16
  2. Log into higher traffic site
  3. Open Stats -> Traffic
  4. Scroll to Authors / Clicks cards
  5. Try to expand the row
  6. Confirm that the row expands and no crash happens

iOS 17

  1. Launch Jetpack app on iOS 117
  2. Log into higher traffic site
  3. Open Stats -> Traffic
  4. Scroll to Authors / Clicks cards
  5. Try to expand the row
  6. Confirm that the row expands and no crash happens

Regression Notes

  1. Potential unintended areas of impact

Couldn't identify

  1. What I did to test those areas of impact (or what existing automated tests I relied on)

Manual testing

  1. What automated tests I added (or what prevented me from doing so)

None

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Testing checklist:

  • WordPress.com sites and self-hosted Jetpack sites.
  • Portrait and landscape orientations.
  • Light and dark modes.
  • Fonts: Larger, smaller and bold text.
  • High contrast.
  • VoiceOver.
  • Languages with large words or with letters/accents not frequently used in English.
  • Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • iPhone and iPad.
  • Multi-tasking: Split view and Slide over. (iPad)

…ead of performBatchUpdates to avoid a crash

performBatchUpdates calls result in crashes on iOS 16 and iOS 17 when diffable data source is used.
@staskus staskus added this to the 24.5 ❄️ milestone Mar 19, 2024
@staskus staskus requested a review from guarani March 19, 2024 10:08
@staskus staskus changed the title Stats: Fix a crash when expanding rows Stats Traffic: Fix a crash on iOS 15 & 16 when expanding rows Mar 19, 2024
@dangermattic
Copy link
Collaborator

1 Warning
⚠️ This PR is assigned to the milestone 24.5 ❄️. The due date for this milestone has already passed.
Please assign it to a milestone with a later deadline or check whether the release for this milestone has already been finished.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Contributor

WordPress Alpha📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
App NameWordPress Alpha WordPress Alpha
ConfigurationRelease-Alpha
Build Numberpr22857-b0fbb2e
Version24.5
Bundle IDorg.wordpress.alpha
Commitb0fbb2e
App Center BuildWPiOS - One-Offs #9188
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@wpmobilebot
Copy link
Contributor

Jetpack Alpha📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
App NameJetpack Alpha Jetpack Alpha
ConfigurationRelease-Alpha
Build Numberpr22857-b0fbb2e
Version24.5
Bundle IDcom.jetpack.alpha
Commitb0fbb2e
App Center Buildjetpack-installable-builds #8232
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

Copy link
Contributor

@guarani guarani left a comment

Choose a reason for hiding this comment

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

Thanks! Tested and works for me 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants