Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
fix: TransactionTooLarge Exception caused by FragmentStateAdapter (#1850
Browse files Browse the repository at this point in the history
)

Previously, the FragmentStateAdapter was saving the state of the
course dashboard view pager tabs upon navigation to the
NavigationActivity. This behaviour resulted in a TransactionTooLarge
Exception when attempting to save the state in the bundle.

To mitigate this issue, we've made adjustments to the caching
mechanism of the ViewPager2. Specifically, we've set the OffPage
limit of the viewPager to ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT,
which leverages the default caching mechanism of RecyclerView.
This modification ensures efficient state handling and resolves the
encountered exception.

Fixes: LEARNER-9897
  • Loading branch information
HamzaIsrar12 authored Mar 27, 2024
1 parent 89d8d4e commit 3667c60
Showing 1 changed file with 0 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -519,10 +519,6 @@ class CourseTabsDashboardFragment : BaseFragment() {
) { tab: TabLayout.Tab, position: Int ->
tab.text = courseTabItems[position].title
}.attach()

if (courseTabItems.size - 1 > 1) {
binding.pager.offscreenPageLimit = courseTabItems.size - 1
}
}

private fun setupToolbar(hasAccess: Boolean) {
Expand Down

0 comments on commit 3667c60

Please sign in to comment.