From 6d96b416ec6b2f79acb5f449b755fe0f2550e0f2 Mon Sep 17 00:00:00 2001 From: Soner Yuksel Date: Wed, 25 Oct 2023 16:27:15 -0400 Subject: [PATCH] Reload section with no animation when drop is done --- .../New Tab Page/NewTabPageViewController.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Sources/Brave/Frontend/Browser/New Tab Page/NewTabPageViewController.swift b/Sources/Brave/Frontend/Browser/New Tab Page/NewTabPageViewController.swift index 33d7379ef8a..ef02218f732 100644 --- a/Sources/Brave/Frontend/Browser/New Tab Page/NewTabPageViewController.swift +++ b/Sources/Brave/Frontend/Browser/New Tab Page/NewTabPageViewController.swift @@ -1232,13 +1232,21 @@ extension NewTabPageViewController: UICollectionViewDragDelegate, UICollectionVi if coordinator.proposal.operation == .move { guard let item = coordinator.items.first else { return } + _ = coordinator.drop(item.dragItem, toItemAt: destinationIndexPath) + guard let favouritesSection = sections.firstIndex(where: { $0 is FavoritesSectionProvider }) else { + return + } + Favorite.reorder( sourceIndexPath: sourceIndexPath, destinationIndexPath: destinationIndexPath, isInteractiveDragReorder: true ) - _ = coordinator.drop(item.dragItem, toItemAt: destinationIndexPath) + + UIView.performWithoutAnimation { + self.collectionView.reloadSections(IndexSet(integer: favouritesSection)) + } } }