From 347f4701147dbdf11da29190b9d61ae6fd613ed8 Mon Sep 17 00:00:00 2001 From: CMK Date: Thu, 27 May 2021 14:06:16 +0800 Subject: [PATCH] fix: data fulfill may delay when first display compose scene issue --- Mastodon/Diffiable/Section/ComposeStatusSection.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Mastodon/Diffiable/Section/ComposeStatusSection.swift b/Mastodon/Diffiable/Section/ComposeStatusSection.swift index 0c4ae8832..0940ddfa4 100644 --- a/Mastodon/Diffiable/Section/ComposeStatusSection.swift +++ b/Mastodon/Diffiable/Section/ComposeStatusSection.swift @@ -55,7 +55,10 @@ extension ComposeStatusSection { switch item { case .replyTo(let replyToStatusObjectID): let cell = collectionView.dequeueReusableCell(withReuseIdentifier: String(describing: ComposeRepliedToStatusContentCollectionViewCell.self), for: indexPath) as! ComposeRepliedToStatusContentCollectionViewCell - managedObjectContext.perform { + // set empty text before retrieve real data to fix pseudo-text display issue + cell.statusView.nameLabel.text = " " + cell.statusView.usernameLabel.text = " " + managedObjectContext.performAndWait { guard let replyTo = managedObjectContext.object(with: replyToStatusObjectID) as? Status else { return } @@ -82,7 +85,7 @@ extension ComposeStatusSection { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: String(describing: ComposeStatusContentCollectionViewCell.self), for: indexPath) as! ComposeStatusContentCollectionViewCell cell.statusContentWarningEditorView.textView.text = attribute.contentWarningContent.value cell.textEditorView.text = attribute.composeContent.value ?? "" - managedObjectContext.perform { + managedObjectContext.performAndWait { guard let replyToStatusObjectID = replyToStatusObjectID, let replyTo = managedObjectContext.object(with: replyToStatusObjectID) as? Status else { cell.statusView.headerContainerView.isHidden = true