diff --git a/android/app/build.gradle b/android/app/build.gradle
index 760cc1d9ea9..816fbcd2acf 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -149,8 +149,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
- versionCode 1001011701
- versionName "1.1.17-1"
+ versionCode 1001011702
+ versionName "1.1.17-2"
}
splits {
abi {
diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist
index 8827fbf84bc..74d1467e8a7 100644
--- a/ios/NewExpensify/Info.plist
+++ b/ios/NewExpensify/Info.plist
@@ -31,7 +31,7 @@
CFBundleVersion
- 1.1.17.1
+ 1.1.17.2
ITSAppUsesNonExemptEncryption
LSApplicationQueriesSchemes
diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist
index 9568054a3ec..bc853c8a3fe 100644
--- a/ios/NewExpensifyTests/Info.plist
+++ b/ios/NewExpensifyTests/Info.plist
@@ -19,6 +19,6 @@
CFBundleSignature
????
CFBundleVersion
- 1.1.17.1
+ 1.1.17.2
diff --git a/package-lock.json b/package-lock.json
index bd15274b616..f9470be2342 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
- "version": "1.1.17-1",
+ "version": "1.1.17-2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/package.json b/package.json
index 0297f6fc69c..bdcff9e03d9 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
- "version": "1.1.17-1",
+ "version": "1.1.17-2",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
diff --git a/src/pages/workspace/withFullPolicy.js b/src/pages/workspace/withFullPolicy.js
index 62eab380d1f..413a1f970f3 100644
--- a/src/pages/workspace/withFullPolicy.js
+++ b/src/pages/workspace/withFullPolicy.js
@@ -2,6 +2,7 @@ import _ from 'underscore';
import lodashGet from 'lodash/get';
import React from 'react';
import PropTypes from 'prop-types';
+import Str from 'expensify-common/lib/str';
import {withOnyx} from 'react-native-onyx';
import {useNavigationState} from '@react-navigation/native';
import CONST from '../../CONST';
@@ -9,7 +10,8 @@ import getComponentDisplayName from '../../libs/getComponentDisplayName';
import * as Policy from '../../libs/actions/Policy';
import ONYXKEYS from '../../ONYXKEYS';
-let previousRoute = '';
+let previousRouteName = '';
+let previousRoutePolicyID = '';
/**
* @param {Object} route
@@ -19,6 +21,19 @@ function getPolicyIDFromRoute(route) {
return lodashGet(route, 'params.policyID', '');
}
+/**
+ * @param {String} routeName
+ * @param {String} policyID
+ * @returns {Boolean}
+ */
+function isPreviousRouteInSameWorkspace(routeName, policyID) {
+ return (
+ Str.startsWith(routeName, 'Workspace')
+ && Str.startsWith(previousRouteName, 'Workspace')
+ && policyID === previousRoutePolicyID
+ );
+}
+
const fullPolicyPropTypes = {
/** The full policy object for the current route (as opposed to the policy summary object) */
policy: PropTypes.shape({
@@ -74,11 +89,12 @@ export default function (WrappedComponent) {
const currentRoute = _.last(useNavigationState(state => state.routes || []));
const policyID = getPolicyIDFromRoute(currentRoute);
- if (_.isString(policyID) && !previousRoute.includes(policyID)) {
+ if (_.isString(policyID) && !_.isEmpty(policyID) && !isPreviousRouteInSameWorkspace(currentRoute.name, policyID)) {
Policy.loadFullPolicy(policyID);
}
- previousRoute = lodashGet(currentRoute, 'path', '');
+ previousRouteName = currentRoute.name;
+ previousRoutePolicyID = policyID;
const rest = _.omit(props, ['forwardedRef', 'policy']);
return (