Skip to content

Commit c49c29e

Browse files
committed
UserLocals: Use computed default for the signed in local
1 parent f915370 commit c49c29e

File tree

1 file changed

+2
-1
lines changed
  • core/auth/ui/compose/src/main/kotlin/com/edricchan/studybuddy/core/auth

1 file changed

+2
-1
lines changed

core/auth/ui/compose/src/main/kotlin/com/edricchan/studybuddy/core/auth/UserLocals.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import androidx.compose.runtime.CompositionLocal
55
import androidx.compose.runtime.CompositionLocalProvider
66
import androidx.compose.runtime.ProvidableCompositionLocal
77
import androidx.compose.runtime.compositionLocalOf
8+
import androidx.compose.runtime.compositionLocalWithComputedDefaultOf
89
import androidx.compose.runtime.getValue
910
import androidx.lifecycle.compose.collectAsStateWithLifecycle
1011
import com.google.firebase.Firebase
@@ -18,7 +19,7 @@ val LocalCurrentUser: ProvidableCompositionLocal<FirebaseUser?> =
1819

1920
/** [CompositionLocal] of whether there's a currently signed-in [FirebaseUser]. */
2021
val LocalIsSignedIn: ProvidableCompositionLocal<Boolean> =
21-
compositionLocalOf { Firebase.auth.currentUser != null }
22+
compositionLocalWithComputedDefaultOf { LocalCurrentUser.currentValue != null }
2223

2324
/**
2425
* Provides the [LocalCurrentUser] and [LocalIsSignedIn] composition locals with the

0 commit comments

Comments
 (0)