Linear issue: https://linear.app/comm/issue/ENG-2316/threadscreenpruner-problem
This code was trying to obtain route for Chat but was obtaining route for Profile. This way we can be sure that we are actually finding what we are looking for.
Details
Run ios simulator, see that both on login screen and when user is logged in no errors arise. I also logged the value that is being returend to be sure this component is being rendered at all.
Diff Detail
- Repository
- rCOMM Comm
- Branch
- inka/chatRoute_fix
- Lint
No Lint Coverage - Unit
No Test Coverage
Event Timeline
native/chat/thread-screen-pruner.react.js | ||
---|---|---|
32 ↗ | (On Diff #18746) | I changed the name because we are not really obtaining a route, but a PossiblyStaleNavigationState extracted from the route. |
It's close!
native/chat/thread-screen-pruner.react.js | ||
---|---|---|
38–42 ↗ | (On Diff #18746) | invariant does not take three params... |
44–48 ↗ | (On Diff #18746) | Can we create a helper in native/navigation/nav-selectors.js that does this? function getChildRouteFromNavigatorRoute(parentRoute, childRouteName) { const parentState = getStateFromNavigatorRoute(parentRoute); const childRoute = parentState.routes.find( route => route.name === childRouteName, ); invariant(childRoute, `parentRoute should contain route for ${childRouteName}`); return childRoute; } (Worth checking if such a helper already exists!) |
I planned changes because something crashed locally, but it was a local cache problem.
In retrospect, a better place for this new helper is actually native/navigation/navigation-utils.js... sorry for changing the request, but could you move it there before landing? 😅
native/navigation/nav-selectors.js | ||
---|---|---|
281 ↗ | (On Diff #18776) | Not sure why it's missing in this file, but in general we should have an extra newline before the export declaration |