Skip to content

Commit

Permalink
chore: wrap individual screens with error boundary (#11273)
Browse files Browse the repository at this point in the history
chore: intercept errors within the screen error boundary
  • Loading branch information
MounirDhahri authored Dec 11, 2024
1 parent 396ab8c commit 216b2bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/app/Components/NotFoundFailureView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Flex, Text, Button, Screen } from "@artsy/palette-mobile"
import { Button, Flex, Screen, Text } from "@artsy/palette-mobile"
import * as Sentry from "@sentry/react-native"
import { goBack } from "app/system/navigation/navigate"
import { useDevToggle } from "app/utils/hooks/useDevToggle"
Expand Down
19 changes: 11 additions & 8 deletions src/app/Navigation/AuthenticatedRoutes/StackNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { useBottomTabBarHeight } from "@react-navigation/bottom-tabs"
import { createNativeStackNavigator } from "@react-navigation/native-stack"
import { ModuleDescriptor } from "app/AppRegistry"
import { RetryErrorBoundary } from "app/Components/RetryErrorBoundary"
import { AuthenticatedRoutesParams } from "app/Navigation/AuthenticatedRoutes/Tabs"
import { isModalScreen } from "app/Navigation/Utils/isModalScreen"
import { goBack } from "app/system/navigation/navigate"
Expand Down Expand Up @@ -92,13 +93,15 @@ export const ScreenWrapper: React.FC<ScreenWrapperProps> = ({
const tabBarHeight = hidesBottomTabs ? 0 : useBottomTabBarHeight()

return (
<Flex
flex={1}
style={{
paddingBottom: hidesBottomTabs ? 0 : tabBarHeight,
}}
>
{children}
</Flex>
<RetryErrorBoundary>
<Flex
flex={1}
style={{
paddingBottom: hidesBottomTabs ? 0 : tabBarHeight,
}}
>
{children}
</Flex>
</RetryErrorBoundary>
)
}

0 comments on commit 216b2bd

Please sign in to comment.