From 3667c607109ef955c3406112d53b82c710c5f9da Mon Sep 17 00:00:00 2001 From: Hamza Israr <71447999+HamzaIsrar12@users.noreply.github.com> Date: Wed, 27 Mar 2024 16:41:40 +0500 Subject: [PATCH] fix: TransactionTooLarge Exception caused by FragmentStateAdapter (#1850) 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 --- .../java/org/edx/mobile/view/CourseTabsDashboardFragment.kt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/OpenEdXMobile/src/main/java/org/edx/mobile/view/CourseTabsDashboardFragment.kt b/OpenEdXMobile/src/main/java/org/edx/mobile/view/CourseTabsDashboardFragment.kt index 9a6dc95b3e..c9b1f8397a 100644 --- a/OpenEdXMobile/src/main/java/org/edx/mobile/view/CourseTabsDashboardFragment.kt +++ b/OpenEdXMobile/src/main/java/org/edx/mobile/view/CourseTabsDashboardFragment.kt @@ -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) {