Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32365785
D10022.1765323456.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D10022.1765323456.diff
View Options
diff --git a/native/navigation/root-router.js b/native/navigation/root-router.js
--- a/native/navigation/root-router.js
+++ b/native/navigation/root-router.js
@@ -79,31 +79,39 @@
invariant(!oldRoute.state, 'resetState found non-matching state');
return { ...oldRoute, ...newPartialRoute };
}
+ const newPartialState = newPartialRoute.state;
+
invariant(oldRoute.state, 'resetState found non-matching state');
+ const oldState = oldRoute.state;
const routes = [];
let newRouteIndex = 0;
let oldRouteIndex = 0;
- while (newRouteIndex < newPartialRoute.state.routes.length) {
- const newSubroute = newPartialRoute.state.routes[newRouteIndex];
- let oldSubroute = oldRoute.state.routes[oldRouteIndex];
+ while (newRouteIndex < newPartialState.routes.length) {
+ const newSubroute = newPartialState.routes[newRouteIndex];
+ let oldSubroute = oldState.routes[oldRouteIndex];
invariant(oldSubroute, 'resetState found a missing oldRoute');
while (oldSubroute.name !== newSubroute.name) {
oldRouteIndex++;
- oldSubroute = oldRoute.state.routes[oldRouteIndex];
+ oldSubroute = oldState.routes[oldRouteIndex];
}
routes.push(resetState(newSubroute, oldSubroute));
newRouteIndex++;
oldRouteIndex++;
}
- let newState = {
- ...oldRoute.state,
- ...newPartialRoute.state,
+ // We extract routes from the state for Flow
+ // It gets overriden in the spread below anyways
+ const { routes: _1, ...oldStateWithoutRoutes } = oldState;
+ const { routes: _2, ...newPartialStateWithoutRoutes } = newPartialState;
+
+ let newState: { +routes: $ReadOnlyArray<ResetStateRoute>, ... } = {
+ ...oldStateWithoutRoutes,
+ ...newPartialStateWithoutRoutes,
routes,
};
- if (_isEqual(newState)(oldRoute.state)) {
- newState = oldRoute.state;
+ if (_isEqual(newState)(oldState)) {
+ newState = oldState;
}
return {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 9, 11:37 PM (15 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5858767
Default Alt Text
D10022.1765323456.diff (1 KB)
Attached To
Mode
D10022: [Flow202][native][skip-ci] [38/x] Fix exponential-spread issue in RootRouter
Attached
Detach File
Event Timeline
Log In to Comment