Skip to content

fix(deeplink): handle cash link and login deeplinks on cold launch#810

Merged
bmc08gt merged 1 commit into
code/cashfrom
fix/cold-start-deeplink
May 30, 2026
Merged

fix(deeplink): handle cash link and login deeplinks on cold launch#810
bmc08gt merged 1 commit into
code/cashfrom
fix/cold-start-deeplink

Conversation

@bmc08gt
Copy link
Copy Markdown
Collaborator

@bmc08gt bmc08gt commented May 30, 2026

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() set AuthState.LoggedInWithUser
immediately 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 just
userManager.set(selectedMetadata.id), deferring the auth state transition
until after the getUserFlags() network call in AuthManager.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)

@bmc08gt bmc08gt self-assigned this May 30, 2026
@github-actions github-actions Bot added the type: fix Bug fix label May 30, 2026
@bmc08gt bmc08gt added the area: deeplinks Deep link handling, URL routing, and link parsing label May 30, 2026
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>
@bmc08gt bmc08gt force-pushed the fix/cold-start-deeplink branch from b049f36 to 0183332 Compare May 30, 2026 12:57
@bmc08gt bmc08gt merged commit e54d1a9 into code/cash May 30, 2026
3 checks passed
@bmc08gt bmc08gt deleted the fix/cold-start-deeplink branch May 30, 2026 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: deeplinks Deep link handling, URL routing, and link parsing type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant