Skip to content

Commit 11bc258

Browse files
authored
Merge pull request #1298 from square/ray/ComposeView-DialogCollator-Fight
Makes `DialogCollator` handle redundant `scheduleUpdate` calls.
2 parents e263954 + c30044e commit 11bc258

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ android.useAndroidX=true
88
systemProp.org.gradle.internal.publish.checksums.insecure=true
99

1010
GROUP=com.squareup.workflow1
11-
VERSION_NAME=1.16.0
11+
VERSION_NAME=1.16.1-SNAPSHOT
1212

1313
POM_DESCRIPTION=Square Workflow
1414

workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/navigation/DialogCollator.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,13 @@ internal class DialogCollator {
186186
onSessionsUpdated: (List<DialogSession>) -> Unit
187187
) {
188188
check(expectedUpdates > 0) {
189-
"Each update() call must be preceded by a call to ViewEnvironment.establishDialogCollator, " +
190-
"but expectedUpdates is $expectedUpdates"
189+
"Each scheduleUpdates() call must be preceded by a call to" +
190+
" ViewEnvironment.establishDialogCollator, but expectedUpdates is $expectedUpdates"
191191
}
192192

193+
// Under nested ComposeView instances we may get redundant updates from the
194+
// same caller. Just throw away the upstream ones.
195+
this.allUpdates.removeAll { it.id == id }
193196
this.allUpdates.add(IdAndUpdates(id, updates, onSessionsUpdated))
194197
if (--expectedUpdates == 0) doUpdate()
195198
}

0 commit comments

Comments
 (0)