From 7baebfeb6ae762db688ed0627be15ab4cb9ba1bc Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Thu, 6 Aug 2020 17:05:53 -0500 Subject: [PATCH] Don't notify the delegate of a selected article change if they haven't actually changed --- Mac/MainWindow/Timeline/TimelineViewController.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Mac/MainWindow/Timeline/TimelineViewController.swift b/Mac/MainWindow/Timeline/TimelineViewController.swift index 089f4ead0..6c05d015c 100644 --- a/Mac/MainWindow/Timeline/TimelineViewController.swift +++ b/Mac/MainWindow/Timeline/TimelineViewController.swift @@ -164,6 +164,8 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr } } + private var previouslySelectedArticles: ArticleArray? + private var oneSelectedArticle: Article? { return selectedArticles.count == 1 ? selectedArticles.first : nil } @@ -816,6 +818,8 @@ extension TimelineViewController: NSTableViewDelegate { } private func selectionDidChange(_ selectedArticles: ArticleArray?) { + guard selectedArticles != previouslySelectedArticles else { return } + previouslySelectedArticles = selectedArticles delegate?.timelineSelectionDidChange(self, selectedArticles: selectedArticles) delegate?.timelineInvalidatedRestorationState(self) }