diff --git a/src/lib/hooks/useIntentHandler.ts b/src/lib/hooks/useIntentHandler.ts index 71a3437ad2..428ed39f81 100644 --- a/src/lib/hooks/useIntentHandler.ts +++ b/src/lib/hooks/useIntentHandler.ts @@ -109,7 +109,18 @@ export function useIntentHandler() { if (previousIntentUrl === incomingUrl) { return } - handleIncomingURL(incomingUrl) + handleIncomingURL(incomingUrl).finally(() => { + /* + * expo-linking caches the URL that launched the app and replays it to + * every new `useLinkingURL`/`getLinkingURL` caller, so an account + * switch (which remounts the tree, see `key={currentAccount?.did}` in + * `App.native.tsx`) or a runtime reload would hand us the same link + * again. Drop it now that it's been handled - this hook is the last + * consumer of the launch URL, everything else reads it while + * rendering, before this effect runs. No-op on web. + */ + Linking.clearInitialURL() + }) previousIntentUrl = incomingUrl } }, [ diff --git a/src/lib/hooks/useOTAUpdates.ts b/src/lib/hooks/useOTAUpdates.ts index 143eb5c619..e628664b82 100644 --- a/src/lib/hooks/useOTAUpdates.ts +++ b/src/lib/hooks/useOTAUpdates.ts @@ -177,12 +177,6 @@ export function useApplyPullRequestOTAUpdate() { updateId: fetchedUpdate.manifest.id, }) try { - /* - * TODO: once expo-linking is upgraded to >= 57, enable this so the - * re-delivered initial URL doesn't trigger a redundant silent check - * after the reload. - */ - // Linking.clearInitialURL() await reloadAsync({ reloadScreenOptions: splash(t.scheme), })