File tree 1 file changed +11
-6
lines changed
voyager-core/src/commonMain/kotlin/cafe/adriel/voyager/core/stack
1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import androidx.compose.runtime.saveable.Saver
9
9
import androidx.compose.runtime.saveable.listSaver
10
10
import androidx.compose.runtime.saveable.rememberSaveable
11
11
import androidx.compose.runtime.setValue
12
+ import androidx.compose.runtime.snapshots.Snapshot
12
13
import androidx.compose.runtime.snapshots.SnapshotStateList
13
14
import androidx.compose.runtime.toMutableStateList
14
15
@@ -111,15 +112,19 @@ public class SnapshotStateStack<Item>(
111
112
}
112
113
113
114
public override infix fun replaceAll (item : Item ) {
114
- stateStack.clear()
115
- stateStack + = item
116
- lastEvent = StackEvent .Replace
115
+ Snapshot .withMutableSnapshot {
116
+ stateStack.clear()
117
+ stateStack + = item
118
+ lastEvent = StackEvent .Replace
119
+ }
117
120
}
118
121
119
122
public override infix fun replaceAll (items : List <Item >) {
120
- stateStack.clear()
121
- stateStack + = items
122
- lastEvent = StackEvent .Replace
123
+ Snapshot .withMutableSnapshot {
124
+ stateStack.clear()
125
+ stateStack + = items
126
+ lastEvent = StackEvent .Replace
127
+ }
123
128
}
124
129
125
130
public override fun pop (): Boolean =
You can’t perform that action at this time.
0 commit comments