Skip to content

DRAIN_EXCLUSIVE_ACTIONS implementation #1355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: sedwards/dea-2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
684 changes: 408 additions & 276 deletions .github/workflows/kotlin.yml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.squareup.workflow1.config
import com.squareup.workflow1.RuntimeConfig
import com.squareup.workflow1.RuntimeConfigOptions
import com.squareup.workflow1.RuntimeConfigOptions.CONFLATE_STALE_RENDERINGS
import com.squareup.workflow1.RuntimeConfigOptions.DRAIN_EXCLUSIVE_ACTIONS
import com.squareup.workflow1.RuntimeConfigOptions.PARTIAL_TREE_RENDERING
import com.squareup.workflow1.RuntimeConfigOptions.RENDER_ONLY_WHEN_STATE_CHANGES
import com.squareup.workflow1.RuntimeConfigOptions.STABLE_EVENT_HANDLERS
Expand Down Expand Up @@ -33,6 +34,10 @@ public class AndroidRuntimeConfigTools {
*
* - `stable` Enables stable event handlers (changes the default value of the `remember`
* parameter of `RenderContext.eventHandler` functions from `false` to `true`)
*
* - `drainExclusive` Enables draining exclusive actions. If we have more actions to process
* that are queued on nodes not affected by the last action application, then we will
* continue to process those actions before another render pass.
*/
@WorkflowExperimentalRuntime
public fun getAppWorkflowRuntimeConfig(): RuntimeConfig {
Expand All @@ -48,6 +53,7 @@ public class AndroidRuntimeConfigTools {
"stateChange" -> config.add(RENDER_ONLY_WHEN_STATE_CHANGES)
"partial" -> config.addAll(setOf(RENDER_ONLY_WHEN_STATE_CHANGES, PARTIAL_TREE_RENDERING))
"stable" -> config.add(STABLE_EVENT_HANDLERS)
"drainExclusive" -> config.add(DRAIN_EXCLUSIVE_ACTIONS)
else -> throw IllegalArgumentException("Unrecognized runtime config option \"$it\"")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.squareup.workflow1.config
import com.squareup.workflow1.RuntimeConfig
import com.squareup.workflow1.RuntimeConfigOptions
import com.squareup.workflow1.RuntimeConfigOptions.CONFLATE_STALE_RENDERINGS
import com.squareup.workflow1.RuntimeConfigOptions.DRAIN_EXCLUSIVE_ACTIONS
import com.squareup.workflow1.RuntimeConfigOptions.PARTIAL_TREE_RENDERING
import com.squareup.workflow1.RuntimeConfigOptions.RENDER_ONLY_WHEN_STATE_CHANGES
import com.squareup.workflow1.RuntimeConfigOptions.STABLE_EVENT_HANDLERS
Expand Down Expand Up @@ -35,6 +36,10 @@ public class JvmTestRuntimeConfigTools {
*
* - `stable` Enables stable event handlers (changes the default value of the `remember`
* parameter of `RenderContext.eventHandler` functions from `false` to `true`)
*
* - `drainExclusive` Enables draining exclusive actions. If we have more actions to process
* that are queued on nodes not affected by the last action application, then we will
* continue to process those actions before another render pass.
*/
@OptIn(WorkflowExperimentalRuntime::class)
public fun getTestRuntimeConfig(): RuntimeConfig {
Expand All @@ -50,6 +55,7 @@ public class JvmTestRuntimeConfigTools {
"stateChange" -> config.add(RENDER_ONLY_WHEN_STATE_CHANGES)
"partial" -> config.addAll(setOf(RENDER_ONLY_WHEN_STATE_CHANGES, PARTIAL_TREE_RENDERING))
"stable" -> config.add(STABLE_EVENT_HANDLERS)
"drainExclusive" -> config.add(DRAIN_EXCLUSIVE_ACTIONS)
else -> throw IllegalArgumentException("Unrecognized runtime config option \"$it\"")
}
}
Expand Down
9 changes: 9 additions & 0 deletions workflow-core/api/workflow-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public final class com/squareup/workflow1/PropsUpdated : com/squareup/workflow1/
public final class com/squareup/workflow1/RuntimeConfigOptions : java/lang/Enum {
public static final field CONFLATE_STALE_RENDERINGS Lcom/squareup/workflow1/RuntimeConfigOptions;
public static final field Companion Lcom/squareup/workflow1/RuntimeConfigOptions$Companion;
public static final field DRAIN_EXCLUSIVE_ACTIONS Lcom/squareup/workflow1/RuntimeConfigOptions;
public static final field PARTIAL_TREE_RENDERING Lcom/squareup/workflow1/RuntimeConfigOptions;
public static final field RENDER_ONLY_WHEN_STATE_CHANGES Lcom/squareup/workflow1/RuntimeConfigOptions;
public static final field STABLE_EVENT_HANDLERS Lcom/squareup/workflow1/RuntimeConfigOptions;
Expand All @@ -180,14 +181,22 @@ public final class com/squareup/workflow1/RuntimeConfigOptions$Companion {

public final class com/squareup/workflow1/RuntimeConfigOptions$Companion$RuntimeOptions : java/lang/Enum {
public static final field CONFLATE Lcom/squareup/workflow1/RuntimeConfigOptions$Companion$RuntimeOptions;
public static final field DEA Lcom/squareup/workflow1/RuntimeConfigOptions$Companion$RuntimeOptions;
public static final field DEFAULT Lcom/squareup/workflow1/RuntimeConfigOptions$Companion$RuntimeOptions;
public static final field RENDER_ONLY Lcom/squareup/workflow1/RuntimeConfigOptions$Companion$RuntimeOptions;
public static final field RENDER_ONLY_CONFLATE Lcom/squareup/workflow1/RuntimeConfigOptions$Companion$RuntimeOptions;
public static final field RENDER_ONLY_CONFLATE_DEA Lcom/squareup/workflow1/RuntimeConfigOptions$Companion$RuntimeOptions;
public static final field RENDER_ONLY_CONFLATE_PARTIAL Lcom/squareup/workflow1/RuntimeConfigOptions$Companion$RuntimeOptions;
public static final field RENDER_ONLY_CONFLATE_PARTIAL_DEA Lcom/squareup/workflow1/RuntimeConfigOptions$Companion$RuntimeOptions;
public static final field RENDER_ONLY_CONFLATE_PARTIAL_STABLE Lcom/squareup/workflow1/RuntimeConfigOptions$Companion$RuntimeOptions;
public static final field RENDER_ONLY_CONFLATE_PARTIAL_STABLE_DEA Lcom/squareup/workflow1/RuntimeConfigOptions$Companion$RuntimeOptions;
public static final field RENDER_ONLY_CONFLATE_STABLE Lcom/squareup/workflow1/RuntimeConfigOptions$Companion$RuntimeOptions;
public static final field RENDER_ONLY_DEA Lcom/squareup/workflow1/RuntimeConfigOptions$Companion$RuntimeOptions;
public static final field RENDER_ONLY_DEA_STABLE Lcom/squareup/workflow1/RuntimeConfigOptions$Companion$RuntimeOptions;
public static final field RENDER_ONLY_PARTIAL Lcom/squareup/workflow1/RuntimeConfigOptions$Companion$RuntimeOptions;
public static final field RENDER_ONLY_PARTIAL_DEA Lcom/squareup/workflow1/RuntimeConfigOptions$Companion$RuntimeOptions;
public static final field RENDER_ONLY_PARTIAL_STABLE Lcom/squareup/workflow1/RuntimeConfigOptions$Companion$RuntimeOptions;
public static final field RENDER_ONLY_PARTIAL_STABLE_DEA Lcom/squareup/workflow1/RuntimeConfigOptions$Companion$RuntimeOptions;
public static final field STABLE Lcom/squareup/workflow1/RuntimeConfigOptions$Companion$RuntimeOptions;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public final fun getRuntimeConfig ()Ljava/util/Set;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ public enum class RuntimeConfigOptions {
@WorkflowExperimentalRuntime
STABLE_EVENT_HANDLERS,

// /**
// * If we have more actions to process that are queued on nodes not affected by the last
// * action application, then we will continue to process those actions before another render
// * pass.
// */
// @WorkflowExperimentalRuntime
// DRAIN_EXCLUSIVE_ACTIONS,
/**
* If we have more actions to process that are queued on nodes not affected by the last
* action application, then we will continue to process those actions before another render
* pass.
*/
@WorkflowExperimentalRuntime
DRAIN_EXCLUSIVE_ACTIONS,
;

public companion object {
Expand Down Expand Up @@ -103,31 +103,31 @@ public enum class RuntimeConfigOptions {
CONFLATE(setOf(CONFLATE_STALE_RENDERINGS)),
STABLE(setOf(STABLE_EVENT_HANDLERS)),

// DEA(setOf(DRAIN_EXCLUSIVE_ACTIONS)),
DEA(setOf(DRAIN_EXCLUSIVE_ACTIONS)),
RENDER_ONLY_CONFLATE(setOf(RENDER_ONLY_WHEN_STATE_CHANGES, CONFLATE_STALE_RENDERINGS)),
RENDER_ONLY_PARTIAL(setOf(RENDER_ONLY_WHEN_STATE_CHANGES, PARTIAL_TREE_RENDERING)),

// RENDER_ONLY_DEA(setOf(RENDER_ONLY_WHEN_STATE_CHANGES, DRAIN_EXCLUSIVE_ACTIONS)),
RENDER_ONLY_DEA(setOf(RENDER_ONLY_WHEN_STATE_CHANGES, DRAIN_EXCLUSIVE_ACTIONS)),
RENDER_ONLY_CONFLATE_STABLE(
setOf(RENDER_ONLY_WHEN_STATE_CHANGES, CONFLATE_STALE_RENDERINGS, STABLE_EVENT_HANDLERS)
),
RENDER_ONLY_CONFLATE_PARTIAL(
setOf(RENDER_ONLY_WHEN_STATE_CHANGES, CONFLATE_STALE_RENDERINGS, PARTIAL_TREE_RENDERING)
),

// RENDER_ONLY_CONFLATE_DEA(
// setOf(RENDER_ONLY_WHEN_STATE_CHANGES, CONFLATE_STALE_RENDERINGS, DRAIN_EXCLUSIVE_ACTIONS)
// ),
RENDER_ONLY_CONFLATE_DEA(
setOf(RENDER_ONLY_WHEN_STATE_CHANGES, CONFLATE_STALE_RENDERINGS, DRAIN_EXCLUSIVE_ACTIONS)
),
RENDER_ONLY_PARTIAL_STABLE(
setOf(RENDER_ONLY_WHEN_STATE_CHANGES, PARTIAL_TREE_RENDERING, STABLE_EVENT_HANDLERS)
),

// RENDER_ONLY_PARTIAL_DEA(
// setOf(RENDER_ONLY_WHEN_STATE_CHANGES, PARTIAL_TREE_RENDERING, DRAIN_EXCLUSIVE_ACTIONS)
// ),
// RENDER_ONLY_DEA_STABLE(
// setOf(RENDER_ONLY_WHEN_STATE_CHANGES, DRAIN_EXCLUSIVE_ACTIONS, STABLE_EVENT_HANDLERS)
// ),
RENDER_ONLY_PARTIAL_DEA(
setOf(RENDER_ONLY_WHEN_STATE_CHANGES, PARTIAL_TREE_RENDERING, DRAIN_EXCLUSIVE_ACTIONS)
),
RENDER_ONLY_DEA_STABLE(
setOf(RENDER_ONLY_WHEN_STATE_CHANGES, DRAIN_EXCLUSIVE_ACTIONS, STABLE_EVENT_HANDLERS)
),
RENDER_ONLY_CONFLATE_PARTIAL_STABLE(
setOf(
RENDER_ONLY_WHEN_STATE_CHANGES,
Expand All @@ -136,31 +136,31 @@ public enum class RuntimeConfigOptions {
STABLE_EVENT_HANDLERS,
)
),
// RENDER_ONLY_CONFLATE_PARTIAL_DEA(
// setOf(
// RENDER_ONLY_WHEN_STATE_CHANGES,
// CONFLATE_STALE_RENDERINGS,
// PARTIAL_TREE_RENDERING,
// DRAIN_EXCLUSIVE_ACTIONS,
// )
// ),
// RENDER_ONLY_PARTIAL_STABLE_DEA(
// setOf(
// RENDER_ONLY_WHEN_STATE_CHANGES,
// PARTIAL_TREE_RENDERING,
// STABLE_EVENT_HANDLERS,
// DRAIN_EXCLUSIVE_ACTIONS,
// )
// ),
// RENDER_ONLY_CONFLATE_PARTIAL_STABLE_DEA(
// setOf(
// RENDER_ONLY_WHEN_STATE_CHANGES,
// CONFLATE_STALE_RENDERINGS,
// PARTIAL_TREE_RENDERING,
// STABLE_EVENT_HANDLERS,
// DRAIN_EXCLUSIVE_ACTIONS,
// )
// ),
RENDER_ONLY_CONFLATE_PARTIAL_DEA(
setOf(
RENDER_ONLY_WHEN_STATE_CHANGES,
CONFLATE_STALE_RENDERINGS,
PARTIAL_TREE_RENDERING,
DRAIN_EXCLUSIVE_ACTIONS,
)
),
RENDER_ONLY_PARTIAL_STABLE_DEA(
setOf(
RENDER_ONLY_WHEN_STATE_CHANGES,
PARTIAL_TREE_RENDERING,
STABLE_EVENT_HANDLERS,
DRAIN_EXCLUSIVE_ACTIONS,
)
),
RENDER_ONLY_CONFLATE_PARTIAL_STABLE_DEA(
setOf(
RENDER_ONLY_WHEN_STATE_CHANGES,
CONFLATE_STALE_RENDERINGS,
PARTIAL_TREE_RENDERING,
STABLE_EVENT_HANDLERS,
DRAIN_EXCLUSIVE_ACTIONS,
)
),
}
}
}
Loading
Loading