From 0a1dd135b415fd9bcfe3ff0d1cf7282c8fed9451 Mon Sep 17 00:00:00 2001 From: OrlaM Date: Tue, 25 Oct 2022 12:33:30 -0400 Subject: [PATCH 1/3] Change order of operations --- Client/Frontend/Home/HomepageViewController.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Client/Frontend/Home/HomepageViewController.swift b/Client/Frontend/Home/HomepageViewController.swift index 7746e9ce724e..b70f0ac4b02d 100644 --- a/Client/Frontend/Home/HomepageViewController.swift +++ b/Client/Frontend/Home/HomepageViewController.swift @@ -269,7 +269,12 @@ class HomepageViewController: UIViewController, HomePanel, FeatureFlaggable { // Force the entire collectionview to re-layout viewModel.refreshData(for: traitCollection) + collectionView.reloadData() collectionView.collectionViewLayout.invalidateLayout() + + // This pushes a reload to the end of the main queue after all the work assocated with + // rotating has been completed. This is important because some of the cells layout + // based on the screen state DispatchQueue.main.async { self.collectionView.reloadData() } @@ -759,8 +764,8 @@ extension HomepageViewController: HomepageViewModelDelegate { guard let self = self else { return } self.viewModel.refreshData(for: self.traitCollection) - self.collectionView.collectionViewLayout.invalidateLayout() self.collectionView.reloadData() + self.collectionView.collectionViewLayout.invalidateLayout() } } } From c27ef2518848d55fa66576cc7b4b3f99c58eac86 Mon Sep 17 00:00:00 2001 From: OrlaM Date: Tue, 25 Oct 2022 16:04:49 -0400 Subject: [PATCH 2/3] Update Client/Frontend/Home/HomepageViewController.swift Co-authored-by: lmarceau --- Client/Frontend/Home/HomepageViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Client/Frontend/Home/HomepageViewController.swift b/Client/Frontend/Home/HomepageViewController.swift index b70f0ac4b02d..a0bd284f61bd 100644 --- a/Client/Frontend/Home/HomepageViewController.swift +++ b/Client/Frontend/Home/HomepageViewController.swift @@ -272,7 +272,7 @@ class HomepageViewController: UIViewController, HomePanel, FeatureFlaggable { collectionView.reloadData() collectionView.collectionViewLayout.invalidateLayout() - // This pushes a reload to the end of the main queue after all the work assocated with + // This pushes a reload to the end of the main queue after all the work associated with // rotating has been completed. This is important because some of the cells layout // based on the screen state DispatchQueue.main.async { From 26450a443b4173da4d60537e650dccc9737308d2 Mon Sep 17 00:00:00 2001 From: OrlaM Date: Tue, 25 Oct 2022 16:04:54 -0400 Subject: [PATCH 3/3] Update Client/Frontend/Home/HomepageViewController.swift Co-authored-by: lmarceau --- Client/Frontend/Home/HomepageViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Client/Frontend/Home/HomepageViewController.swift b/Client/Frontend/Home/HomepageViewController.swift index a0bd284f61bd..22d945c53d81 100644 --- a/Client/Frontend/Home/HomepageViewController.swift +++ b/Client/Frontend/Home/HomepageViewController.swift @@ -273,7 +273,7 @@ class HomepageViewController: UIViewController, HomePanel, FeatureFlaggable { collectionView.collectionViewLayout.invalidateLayout() // This pushes a reload to the end of the main queue after all the work associated with - // rotating has been completed. This is important because some of the cells layout + // rotating has been completed. This is important because some of the cells layout are // based on the screen state DispatchQueue.main.async { self.collectionView.reloadData()