Repository navigation
fix(app): handle deep links via expo-linking (cold-start reliability) - #50
Merged
Merged
Conversation
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>
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.
What
Switches the inbound deep-link handler (
useDeepLinkRecovery) from React Native coreLinkingtoexpo-linking, per theapp/CLAUDE.mdconvention ("Useexpo-linking(not RN coreLinking) for all deep links").Why
RN-core
getInitialURL()is the unreliable path for cold-start deep links on Android — which is exactly thepulse://confirm(signup confirmation) andpulse://reset-passwordemail-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 imperativegetInitialURL()+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;getInitialURLcovers the cold-start case.app/package.json— addexpo-linking(~56.0.14, SDK 56-compatible) as a direct dependency.expo-linkingships untranspiled ESM and isn't intransformIgnorePatterns, so it's mapped to a manual mock (app/__mocks__/expo-linking.ts) viajest.config.cjsmoduleNameMapper, consistent with how the repo mocks other native modules.Outbound
Linking.openURL/openSettingscalls elsewhere (Settings, UpdateRequired screens) are RN-core APIs and are intentionally left unchanged.Verification
npx tsc --noEmit— cleannpx eslint --ext .ts,.tsx src— cleannpx jest— 507 tests pass, 47 suites (the 16useDeepLinkRecoverytests exercise PKCE/implicit/confirm/dedup/cleanup paths)prettier --check— clean🤖 Generated with Claude Code