Skip to content

Commit d0f028c

Browse files
Don't call invalidateIntrinsicContentSize() unless necessary (#2782)
I've seen a severe problem where we're triggering infinite layouts because the frame is reporting changes when nothing has changed. Co-authored-by: Jesse Wilson <jwilson@squareup.com>
1 parent 3320f24 commit d0f028c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

redwood-widget/src/iosMain/kotlin/app/cash/redwood/widget/RedwoodUIView.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,13 @@ public open class RedwoodUIView : RedwoodView<UIView> {
147147

148148
private var widthForIntrinsicSize = UIViewNoIntrinsicMetric
149149
set(value) {
150+
if (value == field) return // Don't invalidateIntrinsicContentSize() if nothing's changed.
150151
field = value
151152
invalidateIntrinsicContentSize()
152153
}
153154
private var heightForIntrinsicSize = UIViewNoIntrinsicMetric
154155
set(value) {
156+
if (value == field) return // Don't invalidateIntrinsicContentSize() if nothing's changed.
155157
field = value
156158
invalidateIntrinsicContentSize()
157159
}

0 commit comments

Comments
 (0)