Page MenuHomePhabricator

D5845.diff
No OneTemporary

D5845.diff

diff --git a/native/chat/thread-screen-pruner.react.js b/native/chat/thread-screen-pruner.react.js
--- a/native/chat/thread-screen-pruner.react.js
+++ b/native/chat/thread-screen-pruner.react.js
@@ -10,7 +10,6 @@
import { useActiveThread } from '../navigation/nav-selectors';
import { NavContext } from '../navigation/navigation-context';
import {
- getStateFromNavigatorRoute,
getThreadIDFromRoute,
getChildRouteFromNavigatorRoute,
} from '../navigation/navigation-utils';
@@ -45,11 +44,17 @@
appRoute,
TabNavigatorRouteName,
);
+ if (!tabRoute) {
+ return null;
+ }
const chatRoute = getChildRouteFromNavigatorRoute(
tabRoute,
ChatRouteName,
);
- return getStateFromNavigatorRoute(chatRoute);
+ if (!chatRoute?.state) {
+ return null;
+ }
+ return chatRoute.state;
}, [navContext]);
const inStackThreadIDs = React.useMemo(() => {
diff --git a/native/navigation/navigation-utils.js b/native/navigation/navigation-utils.js
--- a/native/navigation/navigation-utils.js
+++ b/native/navigation/navigation-utils.js
@@ -152,8 +152,11 @@
function getChildRouteFromNavigatorRoute(
parentRoute: PossiblyStaleRoute<>,
childRouteName: string,
-): PossiblyStaleRoute<> {
- const parentState = getStateFromNavigatorRoute(parentRoute);
+): ?PossiblyStaleRoute<> {
+ if (!parentRoute.state) {
+ return null;
+ }
+ const parentState = parentRoute.state;
const childRoute = parentState.routes.find(
route => route.name === childRouteName,
);

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 19, 1:18 PM (20 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2677483
Default Alt Text
D5845.diff (1 KB)

Event Timeline