@@ -210,15 +210,34 @@ public class ViewGraphNode<NodeView: View, Backend: AppBackend> {
210
210
// since the last update cycle (checked via`!sizeCache.isEmpty`) to
211
211
// ensure that the view has been updated at least once with the
212
212
// current view state.
213
- if dryRun, let currentResult, !resultCache. isEmpty,
214
- ( ( Double ( lastProposedSize. x) >= currentResult. size. maximumWidth
213
+ if dryRun, let currentResult, !resultCache. isEmpty {
214
+ // If both the previous and current proposed sizes are larger than
215
+ // the view's previously computed maximum size, reuse the previous
216
+ // result (currentResult).
217
+ if ( ( Double ( lastProposedSize. x) >= currentResult. size. maximumWidth
215
218
&& Double ( proposedSize. x) >= currentResult. size. maximumWidth)
216
219
|| proposedSize. x == lastProposedSize. x)
217
220
&& ( ( Double ( lastProposedSize. y) >= currentResult. size. maximumHeight
218
221
&& Double ( proposedSize. y) >= currentResult. size. maximumHeight)
219
222
|| proposedSize. y == lastProposedSize. y)
220
- {
221
- return currentResult
223
+ {
224
+ return currentResult
225
+ }
226
+
227
+ // If the view has already been updated this update cycle and claims
228
+ // to be fixed size (maximumSize == minimumSize) then reuse the current
229
+ // result.
230
+ let maximumSize = SIMD2 (
231
+ currentResult. size. maximumWidth,
232
+ currentResult. size. maximumHeight
233
+ )
234
+ let minimumSize = SIMD2 (
235
+ Double ( currentResult. size. minimumWidth) ,
236
+ Double ( currentResult. size. minimumHeight)
237
+ )
238
+ if maximumSize == minimumSize {
239
+ return currentResult
240
+ }
222
241
}
223
242
224
243
parentEnvironment = environment
0 commit comments