diff options
Diffstat (limited to 'src/lib/hooks')
-rw-r--r-- | src/lib/hooks/useIntentHandler.ts | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/hooks/useIntentHandler.ts b/src/lib/hooks/useIntentHandler.ts index 98ba4ec02..a33aff237 100644 --- a/src/lib/hooks/useIntentHandler.ts +++ b/src/lib/hooks/useIntentHandler.ts @@ -13,6 +13,9 @@ type IntentType = 'compose' | 'verify-email' const VALID_IMAGE_REGEX = /^[\w.:\-_/]+\|\d+(\.\d+)?\|\d+(\.\d+)?$/ +// This needs to stay outside of react to persist between account switches +let previousIntentUrl = '' + export function useIntentHandler() { const incomingUrl = Linking.useURL() const composeIntent = useComposeIntent() @@ -68,7 +71,13 @@ export function useIntentHandler() { } } - if (incomingUrl) handleIncomingURL(incomingUrl) + if (incomingUrl) { + if (previousIntentUrl === incomingUrl) { + return + } + handleIncomingURL(incomingUrl) + previousIntentUrl = incomingUrl + } }, [incomingUrl, composeIntent, verifyEmailIntent]) } |