From 98f4bb6bd11b2a8358d900ca241326b30f6f0583 Mon Sep 17 00:00:00 2001 From: Ray Ryan Date: Wed, 30 Apr 2025 09:28:12 -0700 Subject: [PATCH 1/2] Prepare release v1.16.1 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index f78e3c9886..3f0082e4aa 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ android.useAndroidX=true systemProp.org.gradle.internal.publish.checksums.insecure=true GROUP=com.squareup.workflow1 -VERSION_NAME=1.16.0 +VERSION_NAME=1.16.1-SNAPSHOT POM_DESCRIPTION=Square Workflow From c30044e500872a5ea7c4319c4fe6fb7ff85d05a6 Mon Sep 17 00:00:00 2001 From: Ray Ryan Date: Tue, 29 Apr 2025 17:53:45 -0700 Subject: [PATCH 2/2] Makes `DialogCollator` handle redundant `scheduleUpdate` calls. If we have nested `ComposeView` instances they can trigger redundant updates from their `onAttachedToWindow()` hooks. When `DialogCollator` gets duplicate calls from `BodyAndOverlaysContainer` in that situation it throws away earlier ones to avoid creating duplicate `Dialog` windows when `doUpdate()` fires. --- .../com/squareup/workflow1/ui/navigation/DialogCollator.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/navigation/DialogCollator.kt b/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/navigation/DialogCollator.kt index 521d20a1dd..6b79ee0c7b 100644 --- a/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/navigation/DialogCollator.kt +++ b/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/navigation/DialogCollator.kt @@ -186,10 +186,13 @@ internal class DialogCollator { onSessionsUpdated: (List) -> Unit ) { check(expectedUpdates > 0) { - "Each update() call must be preceded by a call to ViewEnvironment.establishDialogCollator, " + - "but expectedUpdates is $expectedUpdates" + "Each scheduleUpdates() call must be preceded by a call to" + + " ViewEnvironment.establishDialogCollator, but expectedUpdates is $expectedUpdates" } + // Under nested ComposeView instances we may get redundant updates from the + // same caller. Just throw away the upstream ones. + this.allUpdates.removeAll { it.id == id } this.allUpdates.add(IdAndUpdates(id, updates, onSessionsUpdated)) if (--expectedUpdates == 0) doUpdate() }