Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 971106e8 authored by Shawn Lee's avatar Shawn Lee
Browse files

[flexiglass] Spread inputs when passing them to rememberSession

Fixes bug where empty inputs were causing the init block passed into rememberSession to be called when it shouldn't have been

Bug: 349868598
Test: manually verified that init block is no longer called in this situation
Flag: com.android.systemui.scene_container
Change-Id: I1add7034f0c68a6709439e3a8ca0f872b4fd5a33
parent c78176d9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ fun Session(storage: SessionStorage = SessionStorage()): Session = SessionImpl(s
 */
@Composable
fun <T> Session.rememberSession(vararg inputs: Any?, key: String? = null, init: () -> T): T =
    rememberSession(key, inputs, init = init)
    rememberSession(key, *inputs, init = init)

/**
 * An explicit storage for remembering composable state outside of the lifetime of a composition.
@@ -151,7 +151,7 @@ fun rememberSaveableSession(
    vararg inputs: Any?,
    key: String? = null,
): SaveableSession =
    rememberSaveable(inputs, SaveableSessionImpl.SessionSaver, key) { SaveableSessionImpl() }
    rememberSaveable(*inputs, SaveableSessionImpl.SessionSaver, key) { SaveableSessionImpl() }

private class SessionImpl(
    private val storage: SessionStorage = SessionStorage(),