Fixed a small issue with re-renderers being dropped (#356)

The code was clearing the queuedRerenders set after processing all of the updates on each re-renderer.  However, during processing it is possible that new values were enqueued.  By clearing the set afterwards, these newly queued re-renderers were accidentally dropped.

This would cause some Views to not update when @State was changed.
This commit is contained in:
David Hunt 2021-01-18 15:39:03 +03:00 committed by GitHub
parent e893e7ad8d
commit 6955e56f77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -123,11 +123,13 @@ public final class StackReconciler<R: Renderer> {
} }
private func updateStateAndReconcile() { private func updateStateAndReconcile() {
for mountedView in queuedRerenders { let queued = queuedRerenders
queuedRerenders.removeAll()
for mountedView in queued {
mountedView.update(with: self) mountedView.update(with: self)
} }
queuedRerenders.removeAll()
performPostrenderCallbacks() performPostrenderCallbacks()
} }