From 35e01018a34db7efaad1f002640c3a3b6d9fe6c2 Mon Sep 17 00:00:00 2001 From: David Christiandy <1299411+dvdchr@users.noreply.github.com> Date: Thu, 26 Oct 2023 01:14:47 +0700 Subject: [PATCH] Add a workaround to reload cell height of recommended tags --- .../Reader/ReaderStreamViewController.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/WordPress/Classes/ViewRelated/Reader/ReaderStreamViewController.swift b/WordPress/Classes/ViewRelated/Reader/ReaderStreamViewController.swift index a4124019c864..9ffb7ced39cd 100644 --- a/WordPress/Classes/ViewRelated/Reader/ReaderStreamViewController.swift +++ b/WordPress/Classes/ViewRelated/Reader/ReaderStreamViewController.swift @@ -696,6 +696,20 @@ import Combine content.refresh() refreshTableViewHeaderLayout() + // TODO: Find a better fix. + // This is a workaround to get the recommended tags card to properly resize after reloading content on tab change. + // Even though the collection view layout returned the correct height, the cell somehow kept its original bounds. + // + // This workaround is limited only to the Discover feed, to prevent unwanted side effects on other tabs. + // Also because the recommended tags card is only shown in Discover. + if let topic = readerTopic, + RemoteFeatureFlag.readerImprovements.enabled(), + ReaderHelpers.topicIsDiscover(topic) { + DispatchQueue.main.async { + self.heightDidChange() + } + } + if synchronize { syncIfAppropriate() }