Skip to content

fix(app): handle deep links via expo-linking (cold-start reliability) - #50

Merged
GJanos merged 1 commit into
developfrom
fix/deeplink-expo-linking
Jun 18, 2026
Merged

GJanos merged 1 commit into
developfrom
fix/deeplink-expo-linking

Conversation

@GJanos

@GJanos GJanos commented Jun 18, 2026

Copy link
Copy Markdown
Owner

What

Switches the inbound deep-link handler (useDeepLinkRecovery) from React Native core Linking to expo-linking, per the app/CLAUDE.md convention ("Use expo-linking (not RN core Linking) for all deep links").

Why

RN-core getInitialURL() is the unreliable path for cold-start deep links on Android — which is exactly the pulse://confirm (signup confirmation) and pulse://reset-password email-tap flow, where the app is launched fresh from a browser/email link. This is part of hardening the auth flow ahead of a tester release.

Changes

  • app/src/hooks/useDeepLinkRecovery.ts — import * as Linking from 'expo-linking'. Kept the existing imperative getInitialURL() + addEventListener('url', …) structure (identical API surface in expo-linking), so the dedup (lastUrlRef) and race-guard (requestId) logic is preserved. useURL() was intentionally not used — it would force ripping out that async-exchange/dedup logic for no behavioral gain; getInitialURL covers the cold-start case.
  • app/package.json — add expo-linking (~56.0.14, SDK 56-compatible) as a direct dependency.
  • Tests — expo-linking ships untranspiled ESM and isn't in transformIgnorePatterns, so it's mapped to a manual mock (app/__mocks__/expo-linking.ts) via jest.config.cjs moduleNameMapper, consistent with how the repo mocks other native modules.

Outbound Linking.openURL / openSettings calls elsewhere (Settings, UpdateRequired screens) are RN-core APIs and are intentionally left unchanged.

Verification

  • npx tsc --noEmit — clean
  • npx eslint --ext .ts,.tsx src — clean
  • npx jest — 507 tests pass, 47 suites (the 16 useDeepLinkRecovery tests exercise PKCE/implicit/confirm/dedup/cleanup paths)
  • prettier --check — clean

Note: cold-start behavior on a real Android device/APK should still be smoke-tested as part of the broader pre-release auth verification.

🤖 Generated with Claude Code

useDeepLinkRecovery imported Linking from react-native core, contrary to the
app convention of using expo-linking for deep links. RN-core getInitialURL is
the unreliable path for cold-start deep links on Android — exactly the
pulse://confirm and pulse://reset-password email-tap flow.

Switch the inbound deep-link handler to expo-linking's getInitialURL +
addEventListener (identical API surface, so the dedup/race-guard logic is
preserved). Outbound openURL/openSettings calls elsewhere are unaffected.

Tests: map expo-linking to a manual mock via jest moduleNameMapper (the module
ships untranspiled ESM and is not in transformIgnorePatterns). Full app suite
green (507 tests).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@GJanos
GJanos merged commit c1d6462 into develop Jun 18, 2026
5 checks passed
@GJanos
GJanos deleted the fix/deeplink-expo-linking branch June 18, 2026 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant