Compare commits

...

1 Commits

Author SHA1 Message Date
Eric Bailey 3fa87785b9 Don't crash when closing dialogs 2025-04-29 15:34:34 -05:00
2 changed files with 13 additions and 13 deletions
+4
View File
@@ -2,6 +2,7 @@ import React from 'react'
import * as Linking from 'expo-linking'
import {logEvent} from '#/lib/statsig/statsig'
import {logger} from '#/logger'
import {isNative} from '#/platform/detection'
import {useSession} from '#/state/session'
import {useComposerControls} from '#/state/shell'
@@ -73,6 +74,9 @@ export function useIntentHandler() {
if (incomingUrl) {
if (previousIntentUrl === incomingUrl) {
logger.debug(`useIntentHandler: ignoring duplicate incoming URL`, {
incomingUrl,
})
return
}
handleIncomingURL(incomingUrl)
+9 -13
View File
@@ -1,9 +1,7 @@
import React from 'react'
import {isWeb} from '#/platform/detection'
import {DialogControlRefProps} from '#/components/Dialog'
import {type DialogControlRefProps} from '#/components/Dialog'
import {Provider as GlobalDialogsProvider} from '#/components/dialogs/Context'
import {BottomSheetNativeComponent} from '../../../modules/bottom-sheet'
interface IDialogContext {
/**
@@ -53,17 +51,15 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
const openDialogs = React.useRef<Set<string>>(new Set())
const closeAllDialogs = React.useCallback(() => {
if (isWeb) {
openDialogs.current.forEach(id => {
const dialog = activeDialogs.current.get(id)
if (dialog) dialog.current.close()
})
openDialogs.current.forEach(id => {
const dialog = activeDialogs.current.get(id)
if (dialog) {
dialog.current.close()
openDialogs.current.delete(id)
}
})
return openDialogs.current.size > 0
} else {
BottomSheetNativeComponent.dismissAll()
return false
}
return openDialogs.current.size > 0
}, [])
const setDialogIsOpen = React.useCallback((id: string, isOpen: boolean) => {