Skip to content

Commit 0df5319

Browse files
committed
fix: use the new delete callback API
Toolbox provides a callback for scenarios that involve the env. deletion. This allows plugins to react and clean the internal state. With the new TBX API, the delete callback API is deprecated in the favor of a mutable state flow, a reactive approach that allows consumers to observe and react to state changes over time.
1 parent a901281 commit 0df5319

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/kotlin/com/coder/toolbox/CoderRemoteEnvironment.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import com.squareup.moshi.Moshi
2727
import kotlinx.coroutines.Job
2828
import kotlinx.coroutines.delay
2929
import kotlinx.coroutines.flow.MutableStateFlow
30+
import kotlinx.coroutines.flow.StateFlow
3031
import kotlinx.coroutines.flow.update
3132
import kotlinx.coroutines.isActive
3233
import kotlinx.coroutines.launch
@@ -269,7 +270,7 @@ class CoderRemoteEnvironment(
269270
}
270271
}
271272

272-
override fun onDelete() {
273+
override val deleteActionFlow: StateFlow<(() -> Unit)?> = MutableStateFlow {
273274
context.cs.launch {
274275
try {
275276
client.removeWorkspace(workspace)

0 commit comments

Comments
 (0)