Move intent handler to a child of InnerApp (#5695)

This commit is contained in:
Hailey
2024-10-11 09:30:30 -07:00
committed by GitHub
parent 8c6384175c
commit 7e5c522718
3 changed files with 13 additions and 3 deletions
+10 -1
View File
@@ -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])
}