diff options
author | Hailey <me@haileyok.com> | 2024-10-11 09:30:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-11 09:30:30 -0700 |
commit | 7e5c522718108b26d6eddc46aba47a2e086a2fe3 (patch) | |
tree | ecf9a76893fcaa58c19aa1a5f5441ad545cc0fbb /src/lib/hooks/useIntentHandler.ts | |
parent | 8c6384175c8343c0cdc14b4fbefd53127f3f1866 (diff) | |
download | voidsky-7e5c522718108b26d6eddc46aba47a2e086a2fe3.tar.zst |
Move intent handler to a child of `InnerApp` (#5695)
Diffstat (limited to 'src/lib/hooks/useIntentHandler.ts')
-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]) } |