From 1e7a6af0bf2f2150409fa6fc7879d0fb6a6f1f0d Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 27 Jun 2021 15:09:10 -0400 Subject: [PATCH] Fix TimelineTableVC item hash including status state Fixes crash when refreshing on iOS 14 --- .../TimelineTableViewController.swift | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/Tusker/Screens/Timeline/TimelineTableViewController.swift b/Tusker/Screens/Timeline/TimelineTableViewController.swift index 377aa5d69f..63b914cb14 100644 --- a/Tusker/Screens/Timeline/TimelineTableViewController.swift +++ b/Tusker/Screens/Timeline/TimelineTableViewController.swift @@ -177,11 +177,11 @@ class TimelineTableViewController: DiffableTimelineLikeTableViewController Bool { + switch (lhs, rhs) { + case let (.status(id: a, state: _), .status(id: b, state: _)): + return a == b + case (.confirmLoadMore, .confirmLoadMore): + return true + default: + return false + } + } + + func hash(into hasher: inout Hasher) { + switch self { + case let .status(id: id, state: _): + hasher.combine(0) + hasher.combine(id) + case .confirmLoadMore: + hasher.combine(1) + } + } } }