diff --git a/compose/runtime/runtime/integration-tests/build.gradle b/compose/runtime/runtime/integration-tests/build.gradle
index d60f695..be1a19f 100644
--- a/compose/runtime/runtime/integration-tests/build.gradle
+++ b/compose/runtime/runtime/integration-tests/build.gradle
@@ -31,6 +31,7 @@
 
     if(!AndroidXComposePlugin.isMultiplatformEnabled(project)) {
         androidTestImplementation(projectOrArtifact(":compose:ui:ui"))
+        androidTestImplementation(projectOrArtifact(":compose:material:material"))
         androidTestImplementation(projectOrArtifact(":compose:ui:ui-test-junit4"))
         androidTestImplementation(project(":compose:runtime:runtime"))
         androidTestImplementation(projectOrArtifact(":compose:test-utils"))
@@ -84,6 +85,7 @@
             }
             androidAndroidTest.dependencies {
                 implementation(projectOrArtifact(":compose:ui:ui"))
+                implementation(projectOrArtifact(":compose:material:material"))
                 implementation(projectOrArtifact(":compose:ui:ui-test-junit4"))
                 implementation(projectOrArtifact(":compose:test-utils"))
                 implementation(projectOrArtifact(":activity:activity-compose"))
diff --git a/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/LiveEditApiTests.kt b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/LiveEditApiTests.kt
new file mode 100644
index 0000000..6d17f5f
--- /dev/null
+++ b/compose/runtime/runtime/integration-tests/src/androidAndroidTest/kotlin/androidx/compose/runtime/LiveEditApiTests.kt
@@ -0,0 +1,259 @@
+/*
+ * Copyright 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.runtime
+
+import androidx.compose.material.Text
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.MediumTest
+import org.junit.Assert.assertTrue
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+
+var someData = mutableStateOf(0)
+
+@RunWith(AndroidJUnit4::class)
+class LiveEditApiTests : BaseComposeTest() {
+    @get:Rule
+    override val activityRule = makeTestActivityRule()
+
+    private fun invalidateGroup(key: Int) {
+        invalidateGroupsWithKey(key)
+    }
+
+    // IMPORTANT: This must be the first test as the lambda key will change if the lambda is
+    // moved this file.
+    @Test
+    @MediumTest
+    fun forceRecompose_setContentLambda() {
+        var setContentLambdaInvoked = 0
+        val setContentLambdaKey = -1216916760 // Extracted from .class file (see note above)
+        activity.show {
+            Text("Some text")
+            setContentLambdaInvoked++
+        }
+        activity.waitForAFrame()
+
+        val setContentLambdaStart = setContentLambdaInvoked
+        invalidateGroup(setContentLambdaKey)
+        activity.waitForAFrame()
+
+        assertTrue(
+            "show's lambda should have been invoked",
+            setContentLambdaInvoked > setContentLambdaStart
+        )
+    }
+
+    @Test
+    @MediumTest
+    fun forceRecompose_Simple() {
+        val activity = activityRule.activity
+        activity.show {
+            TestSimple()
+        }
+        activity.waitForAFrame()
+
+        val someFunctionStart = someFunctionInvoked
+        val nestedContentStart = nestedContentInvoked
+        invalidateGroup(someFunctionKey)
+        activity.waitForAFrame()
+
+        assertTrue(
+            "SomeFunction should have been invoked",
+            someFunctionInvoked > someFunctionStart
+        )
+        assertTrue(
+            "NestedContent should have been invoked",
+            nestedContentInvoked > nestedContentStart
+        )
+    }
+
+    @Test
+    @MediumTest
+    fun forceRecompose_NonRestartable() {
+        val activity = activityRule.activity
+        activity.show {
+            TestNonRestartable()
+        }
+        activity.waitForAFrame()
+
+        val nonRestartableStart = nonRestartableInvoked
+        invalidateGroup(nonRestartableKey)
+
+        activity.waitForAFrame()
+
+        assertTrue(
+            "NonRestartable should have been invoked",
+            nonRestartableInvoked > nonRestartableStart
+        )
+    }
+
+    @Test
+    @MediumTest
+    fun forceRecompose_ReadOnly() {
+        activity.show { TestReadOnly() }
+        activity.waitForAFrame()
+
+        repeat(3) {
+            val readOnlyStart = readOnlyInvoked
+            invalidateGroup(readOnlyKey)
+            activity.waitForAFrame()
+
+            assertTrue(
+                "ReadOnly should have been invoked, iteration $it",
+                readOnlyInvoked > readOnlyStart
+            )
+        }
+    }
+
+    @Test
+    @MediumTest
+    fun forceRecompose_NonRestartableWrapper() {
+        activity.show {
+            TestNonRestartWrapper()
+        }
+
+        activity.waitForAFrame()
+
+        // Ensure that scopes recomposable so the "shouldn't execute" checks below are correct
+        invalidateGroup(nonRestartableKey)
+        activity.waitForAFrame()
+
+        // Invalidate restart
+        run {
+            val nonRestartableStart = nonRestartableInvoked
+            val nonRestartWrapperStart = nonRestartWrapperInvoked
+            invalidateGroup(nonRestartableKey)
+
+            activity.waitForAFrame()
+
+            assertTrue(
+                "NonRestartable should have been invoked",
+                nonRestartableInvoked > nonRestartableStart
+            )
+            assertTrue(
+                "NonRestartWrapper invoked when it shouldn't have been",
+                nonRestartWrapperStart == nonRestartWrapperInvoked
+            )
+        }
+
+        // Invalidate the wrapper
+        run {
+            val nonRestartableStart = nonRestartableInvoked
+            val nonRestartWrapperStart = nonRestartWrapperInvoked
+            invalidateGroup(nonRestartWrapperKey)
+
+            activity.waitForAFrame()
+
+            assertTrue(
+                "NonRestartable should have been invoked",
+                nonRestartableInvoked > nonRestartableStart
+            )
+            assertTrue(
+                "NonRestartWrapper should have been invoked",
+                nonRestartWrapperInvoked > nonRestartWrapperStart
+            )
+        }
+    }
+}
+
+const val someFunctionKey = -1580285603 // Extracted from .class file
+var someFunctionInvoked = 0
+@Composable
+fun SomeFunction(a: Int) {
+    Text("a = $a, someData = ${someData.value}")
+    NestedContent()
+    someFunctionInvoked++
+}
+
+const val nestedContentKey = 1771808426 // Extracted from .class file
+var nestedContentInvoked = 0
+@Composable
+fun NestedContent() {
+    Text("Some nested content: ${someData.value}")
+    nestedContentInvoked++
+}
+
+const val nonRestartableKey = 1860384 // Extracted from .class file
+var nonRestartableInvoked = 0
+@Composable
+@NonRestartableComposable
+fun NonRestartable() {
+    Text("Non restart")
+    nonRestartableInvoked++
+}
+
+const val nonRestartWrapperKey = 1287143243 // Extracted from .class file
+var nonRestartWrapperInvoked = 0
+@Composable
+@NonRestartableComposable
+fun NonRestartWrapper(block: @Composable () -> Unit) {
+    Text("Before")
+    block()
+    Text("After")
+    nonRestartWrapperInvoked++
+}
+
+const val restartableWrapperKey = -153795690 // Extracted from .class file
+var restartWrapperInvoked = 0
+@Composable
+fun RestartableWrapper(block: @Composable () -> Unit) {
+    Text("Before")
+    block()
+    Text("After")
+    restartWrapperInvoked++
+}
+
+const val readOnlyKey = -1414835162 // Extracted from .class file
+var readOnlyInvoked = 0
+@Composable
+@ReadOnlyComposable
+fun ReadOnly() {
+    readOnlyInvoked++
+}
+
+// Test functions
+@Composable
+fun TestSimple() {
+    Text("This is some text")
+    SomeFunction(21)
+}
+
+@Composable
+fun TestNonRestartable() {
+    NonRestartable()
+}
+
+@Composable
+fun TestNonRestartWrapper() {
+    NonRestartWrapper {
+        NonRestartable()
+    }
+    NestedContent()
+}
+
+@Composable
+fun TestReadOnly() {
+    ReadOnly()
+}
+
+@Composable
+fun TestReadOnlyNested() {
+    RestartableWrapper {
+        ReadOnly()
+    }
+}
\ No newline at end of file
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composer.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composer.kt
index cbd9cb1..4eede69 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composer.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composer.kt
@@ -1145,7 +1145,8 @@
     private var groupNodeCountStack = IntStack()
     private var nodeCountOverrides: IntArray? = null
     private var nodeCountVirtualOverrides: HashMap<Int, Int>? = null
-    private var collectParameterInformation = false
+    private var forceRecomposeScopes = false
+    private var forciblyRecompose = false
     private var nodeExpected = false
     private val invalidations: MutableList<Invalidation> = mutableListOf()
     private val entersStack = IntStack()
@@ -1314,8 +1315,8 @@
         parentProvider = parentContext.getCompositionLocalScope()
         providersInvalidStack.push(providersInvalid.asInt())
         providersInvalid = changed(parentProvider)
-        if (!collectParameterInformation) {
-            collectParameterInformation = parentContext.collectingParameterInformation
+        if (!forceRecomposeScopes) {
+            forceRecomposeScopes = parentContext.collectingParameterInformation
         }
         resolveCompositionLocal(LocalInspectionTables, parentProvider)?.let {
             it.add(slotTable)
@@ -1336,6 +1337,7 @@
         recordEndRoot()
         finalizeCompose()
         reader.close()
+        forciblyRecompose = false
     }
 
     /**
@@ -1355,6 +1357,7 @@
         childrenComposing = 0
         nodeExpected = false
         isComposing = false
+        forciblyRecompose = false
     }
 
     internal fun changesApplied() {
@@ -1377,7 +1380,8 @@
     override val skipping: Boolean get() {
         return !inserting && !reusing &&
             !providersInvalid &&
-            currentRecomposeScope?.requiresRecompose == false
+            currentRecomposeScope?.requiresRecompose == false &&
+            !forciblyRecompose
     }
 
     /**
@@ -1393,7 +1397,7 @@
      * determine the parameter values of composable calls.
      */
     override fun collectParameterInformation() {
-        collectParameterInformation = true
+        forceRecomposeScopes = true
     }
 
     @OptIn(InternalComposeApi::class)
@@ -1409,6 +1413,16 @@
         }
     }
 
+    internal fun forceRecomposeScopes(): Boolean {
+        return if (!forceRecomposeScopes) {
+            forceRecomposeScopes = true
+            forciblyRecompose = true
+             true
+        } else {
+            false
+        }
+    }
+
     /**
      * Start a group with the given key. During recomposition if the currently expected group does
      * not match the given key a group the groups emitted in the same parent group are inspected
@@ -1862,7 +1876,7 @@
             ref = CompositionContextHolder(
                 CompositionContextImpl(
                     compoundKeyHash,
-                    collectParameterInformation
+                    forceRecomposeScopes
                 )
             )
             updateValue(ref)
@@ -2601,7 +2615,7 @@
         }
         val result = if (scope != null &&
             !scope.skipped &&
-            (scope.used || collectParameterInformation)
+            (scope.used || forceRecomposeScopes)
         ) {
             if (scope.anchor == null) {
                 scope.anchor = if (inserting) {
@@ -2995,7 +3009,11 @@
         // some invalidations scheduled already. it can happen when during some parent composition
         // there were a change for a state which was used by the child composition. such changes
         // will be tracked and added into `invalidations` list.
-        if (invalidationsRequested.isNotEmpty() || invalidations.isNotEmpty()) {
+        if (
+            invalidationsRequested.isNotEmpty() ||
+            invalidations.isNotEmpty() ||
+            forciblyRecompose
+        ) {
             doCompose(invalidationsRequested, null)
             return changes.isNotEmpty()
         }
@@ -3020,6 +3038,15 @@
             isComposing = true
             try {
                 startRoot()
+
+                // vv Experimental for forced
+                @Suppress("UNCHECKED_CAST")
+                val savedContent = nextSlot()
+                if (savedContent !== content && content != null) {
+                    updateValue(content as Any?)
+                }
+                // ^^ Experimental for forced
+
                 // Ignore reads of derivedStateOf recalculations
                 observeDerivedStateRecalculations(
                     start = {
@@ -3031,9 +3058,17 @@
                 ) {
                     if (content != null) {
                         startGroup(invocationKey, invocation)
-
                         invokeComposable(this, content)
                         endGroup()
+                    } else if (
+                        forciblyRecompose &&
+                        savedContent != null &&
+                        savedContent != Composer.Empty
+                    ) {
+                        startGroup(invocationKey, invocation)
+                        @Suppress("UNCHECKED_CAST")
+                        invokeComposable(this, savedContent as @Composable () -> Unit)
+                        endGroup()
                     } else {
                         skipCurrentGroup()
                     }
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composition.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composition.kt
index 4d0d94a..345e34d6 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composition.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composition.kt
@@ -23,6 +23,7 @@
 import kotlin.coroutines.EmptyCoroutineContext
 import androidx.compose.runtime.collection.IdentityScopeMap
 import androidx.compose.runtime.snapshots.fastAll
+import androidx.compose.runtime.snapshots.fastAny
 import androidx.compose.runtime.snapshots.fastForEach
 
 /**
@@ -502,8 +503,20 @@
         parent.composeInitial(this, composable)
     }
 
-    fun invalidateGroupsWithKey(key: Int): Boolean {
-        return slotTable.invalidateGroupsWithKey(key)
+    fun invalidateGroupsWithKey(key: Int) {
+        val scopesToInvalidate = synchronized(lock) {
+            slotTable.invalidateGroupsWithKey(key)
+        }
+        // Calls to invalidate must be performed without the lock as the they may cause the
+        // recomposer to take its lock to respond to the invalidation and that takes the locks
+        // in the opposite order of composition so if composition begins in another thread taking
+        // trying to take the recomposer lock with the composer lock held will deadlock.
+        val forceComposition = scopesToInvalidate == null || scopesToInvalidate.fastAny {
+            it.invalidateForResult(null) == InvalidationResult.IGNORED
+        }
+        if (forceComposition && composer.forceRecomposeScopes()) {
+            parent.invalidate(this)
+        }
     }
 
     @Suppress("UNCHECKED_CAST")
@@ -1037,7 +1050,7 @@
         }
 
         @TestOnly
-        internal fun invalidateGroupsWithKey(key: Int): Boolean {
+        internal fun invalidateGroupsWithKey(key: Int) {
             return Recomposer.invalidateGroupsWithKey(key)
         }
     }
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Recomposer.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Recomposer.kt
index e1cea2c..cbc2839 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Recomposer.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Recomposer.kt
@@ -318,13 +318,13 @@
             get() = this@Recomposer.hasPendingWork
         override val changeCount: Long
             get() = this@Recomposer.changeCount
-        fun invalidateGroupsWithKey(key: Int): Boolean {
+        fun invalidateGroupsWithKey(key: Int) {
             val compositions: List<ControlledComposition> = synchronized(stateLock) {
                 knownCompositions.toMutableList()
             }
-            return compositions
+            compositions
                 .fastMapNotNull { it as? CompositionImpl }
-                .fastAny { it.invalidateGroupsWithKey(key) }
+                .fastForEach { it.invalidateGroupsWithKey(key) }
         }
         fun saveStateAndDisposeForHotReload(): List<HotReloadable> {
             val compositions: List<ControlledComposition> = synchronized(stateLock) {
@@ -1114,12 +1114,10 @@
             holders.fastForEach { it.recompose() }
         }
 
-        internal fun invalidateGroupsWithKey(key: Int): Boolean {
-            var result = false
+        internal fun invalidateGroupsWithKey(key: Int) {
             _runningRecomposers.value.forEach {
-                result = it.invalidateGroupsWithKey(key) || result
+                it.invalidateGroupsWithKey(key)
             }
-            return result
         }
     }
 }
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SlotTable.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SlotTable.kt
index af8af99..51e342d 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SlotTable.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SlotTable.kt
@@ -290,21 +290,37 @@
     }
 
     /**
-     * Modifies the current slot table such that every group with the target key will be invalidated, and
-     * when recomposed, the content of those groups will be disposed and re-inserted.
+     * Modifies the current slot table such that every group with the target key will be
+     * invalidated, and when recomposed, the content of those groups will be disposed and
+     * re-inserted.
      *
-     * This is currently only used for developer tooling such as Live Edit to invalidate groups which
-     * we know will no longer have the same structure so we want to remove them before recomposing.
+     * This is currently only used for developer tooling such as Live Edit to invalidate groups
+     * which we know will no longer have the same structure so we want to remove them before
+     * recomposing.
+     *
+     * Returns true if all the groups were successfully invalidated. If this returns fals then
+     * the a full composition must be foreced.
      */
-    internal fun invalidateGroupsWithKey(target: Int): Boolean {
+    internal fun invalidateGroupsWithKey(target: Int): List<RecomposeScopeImpl>? {
         val anchors = mutableListOf<Anchor>()
-        // invalidate groups
+        val scopes = mutableListOf<RecomposeScopeImpl>()
+        var allScopesFound = true
+
+        // Invalidate groups with the target key
         read { reader ->
             fun scanGroup() {
                 val key = reader.groupKey
                 if (key == target) {
                     anchors.add(reader.anchor())
-                    invalidateGroup(reader.currentGroup)
+                    if (allScopesFound) {
+                        val nearestScope = findEffectiveRecomposeScope(reader.currentGroup)
+                        if (nearestScope != null) {
+                            scopes.add(nearestScope)
+                        } else {
+                            allScopesFound = false
+                            scopes.clear()
+                        }
+                    }
                     reader.skipGroup()
                     return
                 }
@@ -316,7 +332,9 @@
             }
             scanGroup()
         }
-        // bash keys
+
+        // Bash groups even if we could not invalidate it. The call is responsible for ensuring
+        // the group is recomposed when this happens.
         write { writer ->
             writer.startGroup()
             anchors.fastForEach { anchor ->
@@ -329,30 +347,44 @@
             writer.endGroup()
         }
 
-        return true
+        return if (allScopesFound) scopes else null
     }
 
     /**
-     * Finds the nearest recompose scope to the provided group and invalidates it
+     * Find the nearest recompose scope for [group] that, when invalidated, will cause [group]
+     * group to be recomposed.
      */
-    private fun invalidateGroup(group: Int): Anchor? {
+    private fun findEffectiveRecomposeScope(group: Int): RecomposeScopeImpl? {
+        var current = group
+        while (current > 0) {
+            for (data in DataIterator(this, current)) {
+                if (data is RecomposeScopeImpl) {
+                    return data
+                }
+            }
+            current = groups.parentAnchor(current)
+        }
+        return null
+    }
+
+    /**
+     * Finds the nearest recompose scope to the provided group and invalidates it. Return
+     * true if the invalidation will cause the scope to reccompose, otherwise false which will
+     * require forcing recomposition some other way.
+     */
+    private fun invalidateGroup(group: Int): Boolean {
         var current = group
         // for each parent up the spine
         while (current >= 0) {
             for (data in DataIterator(this, current)) {
                 if (data is RecomposeScopeImpl) {
                     data.requiresRecompose = true
-                    val result = data.invalidateForResult(null)
-                    if (result != InvalidationResult.IGNORED) {
-                        // even though this is nullable, the anchor will not be null if
-                        // the invalidation wasn't ignored
-                        return data.anchor
-                    }
+                    return data.invalidateForResult(null) != InvalidationResult.IGNORED
                 }
             }
             current = groups.parentAnchor(current)
         }
-        return null
+        return false
     }
 
     /**
diff --git a/compose/runtime/runtime/src/jvmTest/kotlin/androidx/compose/runtime/LiveEditTests.kt b/compose/runtime/runtime/src/jvmTest/kotlin/androidx/compose/runtime/LiveEditTests.kt
index bf75954..6e7b05e 100644
--- a/compose/runtime/runtime/src/jvmTest/kotlin/androidx/compose/runtime/LiveEditTests.kt
+++ b/compose/runtime/runtime/src/jvmTest/kotlin/androidx/compose/runtime/LiveEditTests.kt
@@ -90,7 +90,7 @@
 
     @Test
     fun testNonRestartableFunctionPreservesParentAndSiblingState() = liveEditTest {
-        EnsureStatePreservedAndNotRecomposed("a")
+        EnsureStatePreservedButRecomposed("a")
         RestartGroup {
             Text("Hello World")
             EnsureStatePreservedButRecomposed("b")
@@ -280,7 +280,7 @@
         addLogCheck(ref) { logs ->
             val actual = logs.filter { m -> m == msg }.count()
             Assert.assertEquals(
-                "Ref $ref had an unexpected # of '$msg' logs",
+                "Ref '$ref' had an unexpected # of '$msg' logs",
                 expected,
                 actual
             )
