Skip to content

Commit ae0d91f

Browse files
author
Rover Release Bot 🤖
committed
Releasing 4.10.1
1 parent 91ed40f commit ae0d91f

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

Sources/Experiences/ClassicExperiences/UI/Views/TextCell.swift

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,27 @@ class TextCell: BlockCell {
3434
return textView
3535
}
3636

37+
private var currentBlockID: String?
38+
3739
override func configure(with block: ClassicBlock) {
3840
super.configure(with: block)
39-
41+
4042
guard let textBlock = block as? ClassicTextBlock else {
4143
textView.isHidden = true
4244
return
4345
}
4446

4547
textView.isHidden = false
46-
textView.attributedText = textBlock.text.attributedText(forFormat: .html)
48+
self.currentBlockID = block.id
49+
50+
// NSAttributedString, when initialized with the HTML options that we use, internally uses WebKit/NSHTMLReader. These have internal async operations that can synchronously run a mainloop tick, but given that configure() is running in the context of func collectionView(:, cellForItemAt:), this could potentially cause NSInternalConsistencyException under certain conditions.
51+
DispatchQueue.main.async { [weak self] in
52+
// check that this callback isn't stale, and would clobber a configure() that has occurred since.
53+
guard let self = self, block.id == self.currentBlockID else {
54+
return
55+
}
56+
57+
textView.attributedText = textBlock.text.attributedText(forFormat: .html)
58+
}
4759
}
4860
}

Sources/Foundation/Meta.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ import Foundation
1717

1818
public enum Meta {
1919
public static let APIVersion: Int = 2
20-
public static let SDKVersion: String = "4.10.0"
20+
public static let SDKVersion: String = "4.10.1"
2121
}

0 commit comments

Comments
 (0)