fix(deeplink): handle cash link and login deeplinks on cold launch#810
Merged
Conversation
LaunchedEffect(deepLink) in App.kt fired once during cold start, saw currentRouteKey was Loading, and bailed out. MainRoot intentionally defers OpenCashLink/Login actions to App.kt (navigates to plain Scanner without forwarding the entropy). Since deepLink never changed, the effect never re-fired and the link was permanently lost. Add currentRoute as a LaunchedEffect key so the effect re-launches when MainRoot replaces the backstack from Loading to Scanner. The deep link is then dispatched normally (session.openCashLink or viewModel.handleLoginEntropy). The LaunchedEffect(deepLink) single-key pattern was a latent race introduced in 1219d38 (Nav3 migration). It relied on MainRoot transitioning away from Loading before Rinku delivered the deep link (~2-3 frames of async delay). This worked because PassphraseCredentialManager.login() set AuthState.LoggedInWithUser immediately on the fast path — before any network calls — so MainRoot navigated past Loading near-instantly. cfe2964 (#778) changed that fast path from updateUserManager(id, LoggedInWithUser) to just userManager.set(selectedMetadata.id), deferring the auth state transition until after the getUserFlags() network call. This shifted the timing so Rinku now consistently delivers the deep link while still on Loading, the LaunchedEffect bails, and the link is lost. Latent fragility: 1219d38 (fcash/2026.3.4) Surfaced by: cfe2964 (fcash/2026.5.6) Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
b049f36 to
0183332
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LaunchedEffect(deepLink) in App.kt fired once during cold start, saw
currentRouteKey was Loading, and bailed out. MainRoot intentionally defers
OpenCashLink/Login actions to App.kt (navigates to plain Scanner without
forwarding the entropy). Since deepLink never changed, the effect never
re-fired and the link was permanently lost.
Add currentRoute as a LaunchedEffect key so the effect re-launches when
MainRoot replaces the backstack from Loading to Scanner. The deep link is
then dispatched normally (session.openCashLink or viewModel.handleLoginEntropy).
Root cause
The LaunchedEffect(deepLink) single-key pattern was a latent race introduced
in 1219d38 (Nav3 migration, fcash/2026.3.4). It relied on MainRoot
transitioning away from Loading before Rinku delivered the deep link
(~2-3 frames of async delay). This worked because
PassphraseCredentialManager.login()setAuthState.LoggedInWithUserimmediately on the fast path (existing user, stored credential match) —
before any network calls — so MainRoot navigated past Loading near-instantly.
cfe2964 (#778, fcash/2026.5.6) changed that fast path from
updateUserManager(id, AuthState.LoggedInWithUser)to justuserManager.set(selectedMetadata.id), deferring the auth state transitionuntil after the
getUserFlags()network call inAuthManager.login().This shifted the timing so Rinku now consistently delivers the deep link
while still on Loading, the LaunchedEffect bails, and the link is lost.
Latent fragility: 1219d38 (fcash/2026.3.4)
Surfaced by: cfe2964 (fcash/2026.5.6)